org.eclipse.core.databinding.observable

## Class Diffs

- java.lang.Object
- - org.eclipse.core.databinding.observable.Diffs

    public class Diffs
    extends Object

Since:
  1.0

### Constructor Summary

Constructors
Constructor and Description
`Diffs()`

### Method Summary

All Methods Static Methods Concrete Methods
`static <E> ListDiff<E>` `computeLazyListDiff(List<? extends E> oldList, List<? extends E> newList)` Returns a lazily computed `ListDiff` describing 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 computed `MapDiff` describing 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 computed `SetDiff` describing the change between the specified old and new set states.
`static <E> ListDiff<E>` `computeListDiff(List<? extends E> oldList, List<? extends E> newList)` Returns a `ListDiff` describing 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 a `MapDiff` describing the change between the specified old and new map states.
`static <E> SetDiff<E>` `computeSetDiff(Set<? extends E> oldSet, Set<? extends E> newSet)` Returns a `SetDiff` describing 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 key
`static <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 values
`static boolean` `equals(Object left, Object right)` Checks whether the two objects are `null` -- allowing for `null`.
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Diffs

    public Diffs()

### Method Detail

#### unmodifiableDiff

    public static <E> ListDiff<E> unmodifiableDiff(ListDiff<? extends E> diff)

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 a `ListDiff<? extends E>` into a `ListDiff<E>`.

Parameters:
  `diff` - the diff to convert
Returns:
  an unmodifiable wrapper on top of the given diff
Since:
  1.6

#### unmodifiableDiff

    public static <E> SetDiff<E> unmodifiableDiff(SetDiff<? extends E> diff)

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 a `SetDiff<? extends E>` into a `SetDiff<E>`.

Parameters:
  `diff` - the diff to convert
Returns:
  an unmodifiable wrapper on top of the given diff
Since:
  1.6

#### unmodifiableDiff

    public static <K,V> MapDiff<K,V> unmodifiableDiff(MapDiff<? extends K,? extends V> diff)

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 a `MapDiff<? extends K, ? extends V>` into a `MapDiff<K,V>`.

Parameters:
  `diff` - the diff to convert
Returns:
  an unmodifiable wrapper on top of the given diff
Since:
  1.6

#### unmodifiableDiff

    public static <V> ValueDiff<V> unmodifiableDiff(ValueDiff<? extends V> diff)

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 a `ValueDiff<? extends V>` into a `ValueDiff<V>`.

Parameters:
  `diff` - the diff to convert
Returns:
  an unmodifiable wrapper on top of the given diff
Since:
  1.6

#### computeListDiff

    public static <E> ListDiff<E> computeListDiff(List<? extends E> oldList,
                                                  List<? extends E> newList)

Returns a `ListDiff` describing the change between the specified old and new list states.

Type Parameters:
  `E` - the list element type
Parameters:
  `oldList` - the old list state
  `newList` - 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 computed `ListDiff` describing the change between the specified old and new list states.

Type Parameters:
  `E` - the list element type
Parameters:
  `oldList` - the old list state
  `newList` - the new list state
Returns:
  a lazily computed `ListDiff` describing the change between the specified old and new list states.
Since:
  1.3

#### equals

    public static final boolean equals(Object left,
                                       Object right)

Checks whether the two objects are `null` -- allowing for `null`.

Parameters:
  `left` - The left object to compare; may be `null`.
  `right` - The right object to compare; may be `null`.
Returns:
  `true` if the two objects are equivalent; `false` otherwise.

#### computeSetDiff

    public static <E> SetDiff<E> computeSetDiff(Set<? extends E> oldSet,
                                                Set<? extends E> newSet)

Returns a `SetDiff` describing the change between the specified old and new set states.

Type Parameters:
  `E` - the set element type
Parameters:
  `oldSet` - the old set state
  `newSet` - the new set state
Returns:
  a `SetDiff` describing the change between the specified old and new set states.

#### computeLazySetDiff

    public static <E> SetDiff<E> computeLazySetDiff(Set<? extends E> oldSet,
                                                    Set<? extends E> newSet)

Returns a lazily computed `SetDiff` describing the change between the specified old and new set states.

Type Parameters:
  `E` - the set element type
Parameters:
  `oldSet` - the old set state
  `newSet` - the new set state
Returns:
  a lazily computed `SetDiff` describing 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 a `MapDiff` describing the change between the specified old and new map states.

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `oldMap` - the old map state
  `newMap` - the new map state
Returns:
  a `MapDiff` describing 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 computed `MapDiff` describing the change between the specified old and new map states.

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `oldMap` - the old map state
  `newMap` - the new map state
Returns:
  a lazily computed `MapDiff` describing the change between the specified old and new map states.
Since:
  1.3

#### createValueDiff

    public static <T> ValueDiff<T> createValueDiff(T oldValue,
                                                   T newValue)

Creates a diff between two values

Type Parameters:
  `T` - the value type
Parameters:
  `oldValue` -
  `newValue` -
Returns:
  a value diff

#### createSetDiff

    public static <E> SetDiff<E> createSetDiff(Set<? extends E> additions,
                                               Set<? extends E> removals)

Type Parameters:
  `E` - the set element type
Parameters:
  `additions` -
  `removals` -
Returns:
  a set diff

#### createListDiff

    public static <E> ListDiff<E> createListDiff(ListDiffEntry<E> difference)

Type Parameters:
  `E` - the list element type
Parameters:
  `difference` -
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` -
  `difference2` -
Returns:
  a list diff with two differing entries

#### createListDiff

    public static <E> ListDiff<E> createListDiff(ListDiffEntry<E>[] differences)

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` -
Returns:
  a list diff with the given entries

#### createListDiff

    public static <E> ListDiff<E> createListDiff(List<ListDiffEntry<E>> differences)

Creates a new ListDiff object given its constituent ListDiffEntry objects.

Type Parameters:
  `E` - the list element type
Parameters:
  `differences` -
Returns:
  a list diff with the given entries
Since:
  1.6

#### createListDiffEntry

    public static <E> ListDiffEntry<E> createListDiffEntry(int position,
                                                           boolean isAddition,
                                                           E element)

Type Parameters:
  `E` - the list element type
Parameters:
  `position` -
  `isAddition` -
  `element` -
Returns:
  a list diff entry

#### createMapDiffSingleAdd

    public static <K,V> MapDiff<K,V> createMapDiffSingleAdd(K addedKey,
                                                            V newValue)

Creates a MapDiff representing the addition of a single added key

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `addedKey` -
  `newValue` -
Returns:
  a map diff

#### createMapDiffSingleChange

    public static <K,V> MapDiff<K,V> createMapDiffSingleChange(K existingKey,
                                                               V oldValue,
                                                               V newValue)

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `existingKey` -
  `oldValue` -
  `newValue` -
Returns:
  a map diff

#### createMapDiffSingleRemove

    public static <K,V> MapDiff<K,V> createMapDiffSingleRemove(K removedKey,
                                                               V oldValue)

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `removedKey` -
  `oldValue` -
Returns:
  a map diff

#### createMapDiffRemoveAll

    public static <K,V> MapDiff<K,V> createMapDiffRemoveAll(Map<K,V> copyOfOldMap)

Type Parameters:
  `K` - the type of keys maintained by this map
  `V` - the type of mapped values
Parameters:
  `copyOfOldMap` -
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 map
  `V` - the type of mapped values
Parameters:
  `addedKeys` -
  `removedKeys` -
  `changedKeys` -
  `oldValues` -
  `newValues` -
Returns:
  a map diff