Class DittoDiffer

java.lang.Object
com.ditto.java.DittoDiffer
All Implemented Interfaces:
AutoCloseable

@Deprecated public class DittoDiffer extends Object implements AutoCloseable
Deprecated.
Diffing is now managed automatically by the observer when using the diff-aware overloads of DittoStore.registerObserver(String, DittoChangeListenerWithDiff). Closing the observer automatically frees the differ's native resources, eliminating the need to manage a separate DittoDiffer instance.
Calculates diffs between lists of DittoQueryResultItem.
  • Method Details

    • diff

      public DittoDiff diff(List<? extends DittoQueryResultItem> items)
      Deprecated.

      Calculate the diff of the provided items against the last set of items that were passed to this differ.

      The returned DittoDiff identifies changes from the old list of items to the new list of items using indices into both lists.

      Initially, the Differ has no items, so the first call to this method will always return a diff showing all items as insertions.

      The identity of items is determined by their "_id" field.

      Parameters:
      items - The query result items to compare against the last list of items.
      Returns:
      A DittoDiff describing the changes.
    • close

      public void close() throws Exception
      Deprecated.
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception