Class Diffs
java.lang.Object
org.eclipse.core.databinding.observable.Diffs
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ListDiff<E> computeLazyListDiff(List<? extends E> oldList, List<? extends E> newList) Returns a lazily computedListDiffdescribing the change between the specified old and new list states.static <K,V> MapDiff <K, V> computeLazyMapDiff(Map<? extends K, ? extends V> oldMap, Map<? extends K, ? extends V> newMap) Returns a lazily computedMapDiffdescribing the change between the specified old and new map states.static <E> SetDiff<E> computeLazySetDiff(Set<? extends E> oldSet, Set<? extends E> newSet) Returns a lazily computedSetDiffdescribing the change between the specified old and new set states.static <E> ListDiff<E> computeListDiff(List<? extends E> oldList, List<? extends E> newList) Returns aListDiffdescribing the change between the specified old and new list states.static <K,V> MapDiff <K, V> computeMapDiff(Map<? extends K, ? extends V> oldMap, Map<? extends K, ? extends V> newMap) Returns aMapDiffdescribing the change between the specified old and new map states.static <E> SetDiff<E> computeSetDiff(Set<? extends E> oldSet, Set<? extends E> newSet) Returns aSetDiffdescribing the change between the specified old and new set states.static <E> ListDiff<E> createListDiff(List<ListDiffEntry<E>> differences) Creates a new ListDiff object given its constituent ListDiffEntry objects.static <E> ListDiff<E> createListDiff(ListDiffEntry<E> difference) static <E> ListDiff<E> createListDiff(ListDiffEntry<E>... differences) Creates a new ListDiff object given its constituent ListDiffEntry objects.static <E> ListDiff<E> createListDiff(ListDiffEntry<E> difference1, ListDiffEntry<E> difference2) static <E> ListDiffEntry<E> createListDiffEntry(int position, boolean isAddition, E element) static <K,V> MapDiff <K, V> createMapDiff(Set<? extends K> addedKeys, Set<? extends K> removedKeys, Set<? extends K> changedKeys, Map<? extends K, ? extends V> oldValues, Map<? extends K, ? extends V> newValues) static <K,V> MapDiff <K, V> createMapDiffRemoveAll(Map<K, V> copyOfOldMap) static <K,V> MapDiff <K, V> createMapDiffSingleAdd(K addedKey, V newValue) Creates a MapDiff representing the addition of a single added keystatic <K,V> MapDiff <K, V> createMapDiffSingleChange(K existingKey, V oldValue, V newValue) static <K,V> MapDiff <K, V> createMapDiffSingleRemove(K removedKey, V oldValue) static <E> SetDiff<E> createSetDiff(Set<? extends E> additions, Set<? extends E> removals) static <T> ValueDiff<T> createValueDiff(T oldValue, T newValue) Creates a diff between two valuesstatic final booleanDeprecated.static <E> ListDiff<E> unmodifiableDiff(ListDiff<? extends E> diff) Returns an unmodifiable wrapper on top of the given diff.static <K,V> MapDiff <K, V> unmodifiableDiff(MapDiff<? extends K, ? extends V> diff) Returns an unmodifiable wrapper on top of the given diff.static <E> SetDiff<E> unmodifiableDiff(SetDiff<? extends E> diff) Returns an unmodifiable wrapper on top of the given diff.static <V> ValueDiff<V> unmodifiableDiff(ValueDiff<? extends V> diff) Returns an unmodifiable wrapper on top of the given diff.
-
Constructor Details
-
Diffs
public Diffs()
-
-
Method Details
-
unmodifiableDiff
Returns an unmodifiable wrapper on top of the given diff. The returned diff will suppress any attempt to modify the collections it returns. Diffs are normally unmodifiable anyway, so this method is mainly used as a type-safe way to convert aListDiff<? extends E>into aListDiff<E>.- Parameters:
diff- the diff to convert- Returns:
- an unmodifiable wrapper on top of the given diff
- Since:
- 1.6
-
unmodifiableDiff
Returns an unmodifiable wrapper on top of the given diff. The returned diff will suppress any attempt to modify the collections it returns. Diffs are normally unmodifiable anyway, so this method is mainly used as a type-safe way to convert aSetDiff<? extends E>into aSetDiff<E>.- Parameters:
diff- the diff to convert- Returns:
- an unmodifiable wrapper on top of the given diff
- Since:
- 1.6
-
unmodifiableDiff
Returns an unmodifiable wrapper on top of the given diff. The returned diff will suppress any attempt to modify the collections it returns. Diffs are normally unmodifiable anyway, so this method is mainly used as a type-safe way to convert aMapDiff<? extends K, ? extends V>into aMapDiff<K,V>.- Parameters:
diff- the diff to convert- Returns:
- an unmodifiable wrapper on top of the given diff
- Since:
- 1.6
-
unmodifiableDiff
Returns an unmodifiable wrapper on top of the given diff. The returned diff will suppress any attempt to modify the collections it returns. Diffs are normally unmodifiable anyway, so this method is mainly used as a type-safe way to convert aValueDiff<? extends V>into aValueDiff<V>.- Parameters:
diff- the diff to convert- Returns:
- an unmodifiable wrapper on top of the given diff
- Since:
- 1.6
-
computeListDiff
Returns aListDiffdescribing the change between the specified old and new list states.- Type Parameters:
E- the list element type- Parameters:
oldList- the old list statenewList- the new list state- Returns:
- the differences between oldList and newList
- Since:
- 1.6
-
computeLazyListDiff
public static <E> ListDiff<E> computeLazyListDiff(List<? extends E> oldList, List<? extends E> newList) Returns a lazily computedListDiffdescribing the change between the specified old and new list states.- Type Parameters:
E- the list element type- Parameters:
oldList- the old list statenewList- the new list state- Returns:
- a lazily computed
ListDiffdescribing the change between the specified old and new list states. - Since:
- 1.3
-
equals
Deprecated.UseObjects.equals(Object, Object)insteadChecks whether the two objects arenull-- allowing fornull.- Parameters:
left- The left object to compare; may benull.right- The right object to compare; may benull.- Returns:
trueif the two objects are equivalent;falseotherwise.
-
computeSetDiff
Returns aSetDiffdescribing the change between the specified old and new set states.- Type Parameters:
E- the set element type- Parameters:
oldSet- the old set statenewSet- the new set state- Returns:
- a
SetDiffdescribing the change between the specified old and new set states.
-
computeLazySetDiff
Returns a lazily computedSetDiffdescribing the change between the specified old and new set states.- Type Parameters:
E- the set element type- Parameters:
oldSet- the old set statenewSet- the new set state- Returns:
- a lazily computed
SetDiffdescribing the change between the specified old and new set states. - Since:
- 1.3
-
computeMapDiff
public static <K,V> MapDiff<K,V> computeMapDiff(Map<? extends K, ? extends V> oldMap, Map<? extends K, ? extends V> newMap) Returns aMapDiffdescribing the change between the specified old and new map states.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
oldMap- the old map statenewMap- the new map state- Returns:
- a
MapDiffdescribing the change between the specified old and new map states.
-
computeLazyMapDiff
public static <K,V> MapDiff<K,V> computeLazyMapDiff(Map<? extends K, ? extends V> oldMap, Map<? extends K, ? extends V> newMap) Returns a lazily computedMapDiffdescribing the change between the specified old and new map states.- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
oldMap- the old map statenewMap- the new map state- Returns:
- a lazily computed
MapDiffdescribing the change between the specified old and new map states. - Since:
- 1.3
-
createValueDiff
Creates a diff between two values- Type Parameters:
T- the value type- Parameters:
oldValue- the old valuenewValue- the new value- Returns:
- a value diff
-
createSetDiff
- Type Parameters:
E- the set element type- Parameters:
additions- the added elementsremovals- the removed elements- Returns:
- a set diff
-
createListDiff
- Type Parameters:
E- the list element type- Parameters:
difference- the entry to describe the added or removed element- Returns:
- a list diff with one differing entry
-
createListDiff
public static <E> ListDiff<E> createListDiff(ListDiffEntry<E> difference1, ListDiffEntry<E> difference2) - Type Parameters:
E- the list element type- Parameters:
difference1- the first entry to describe the added or removed elementdifference2- the second entry to describe the added or removed element- Returns:
- a list diff with two differing entries
-
createListDiff
Creates a new ListDiff object given its constituent ListDiffEntry objects.This form cannot be used in a type-safe manner because it is not possible to construct an array of generic types in a type-safe manner. Use the form below which takes a properly parameterized List.
- Type Parameters:
E- the list element type- Parameters:
differences- a list of entries describing additions and/or removals from a list- Returns:
- a list diff with the given entries
-
createListDiff
Creates a new ListDiff object given its constituent ListDiffEntry objects.- Type Parameters:
E- the list element type- Parameters:
differences- a list of entries describing additions and/or removals from a list- Returns:
- a list diff with the given entries
- Since:
- 1.6
-
createListDiffEntry
- Type Parameters:
E- the list element type- Parameters:
position- position where list is changedisAddition-trueif element is added orfalseif removedelement- the added or removed element- Returns:
- a list diff entry
-
createMapDiffSingleAdd
Creates a MapDiff representing the addition of a single added key- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
addedKey- key added to mapnewValue- value of the added key- Returns:
- a map diff
-
createMapDiffSingleChange
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
existingKey- key of the changed elementoldValue- old value for keynewValue- new value for key- Returns:
- a map diff
-
createMapDiffSingleRemove
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
removedKey- key removed from mapoldValue- value of the removed key- Returns:
- a map diff
-
createMapDiffRemoveAll
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
copyOfOldMap- map content before removal- Returns:
- a map diff
-
createMapDiff
public static <K,V> MapDiff<K,V> createMapDiff(Set<? extends K> addedKeys, Set<? extends K> removedKeys, Set<? extends K> changedKeys, Map<? extends K, ? extends V> oldValues, Map<? extends K, ? extends V> newValues) - Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values- Parameters:
addedKeys- the keys added to mapremovedKeys- the keys removed from mapchangedKeys- the keys with changed valuesoldValues- map of removed key values and old values of changed keysnewValues- map of added key values and new values of changed keys- Returns:
- a map diff
-
Objects.equals(Object, Object)instead