Class MapDiff<K,V>

java.lang.Object
org.eclipse.core.databinding.observable.map.MapDiff<K,V>
Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
All Implemented Interfaces:
IDiff

public abstract class MapDiff<K,V> extends Object implements IDiff
Since:
1.1
  • Constructor Details

    • MapDiff

      public MapDiff()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns true if the diff has no added, removed or changed entries.
      Returns:
      true if the diff has no added, removed or changed entries.
      Since:
      1.2
    • applyTo

      public void applyTo(Map<? super K,? super V> map)
      Applies the changes in this diff to the given map
      Parameters:
      map - the map to which the diff will be applied
      Since:
      1.2
    • simulateOn

      public Map<K,V> simulateOn(Map<K,V> map)
      Returns a map showing what map would look like if this diff were applied to it.

      Note: the returned map is only valid until structural changes are made to the passed-in map.

      Parameters:
      map - the map over which the diff will be simulated
      Returns:
      an unmodifiable map showing what map would look like if it were passed to the applyTo(Map) method.
      Since:
      1.3
      See Also:
    • getAddedKeys

      public abstract Set<K> getAddedKeys()
      Returns:
      the set of keys which were added
    • getRemovedKeys

      public abstract Set<K> getRemovedKeys()
      Returns:
      the set of keys which were removed
    • getChangedKeys

      public abstract Set<K> getChangedKeys()
      Returns:
      the set of keys for which the value has changed
    • getOldValue

      public abstract V getOldValue(Object key)
      Returns the old value for the given key, which must be an element of getRemovedKeys() or getChangedKeys().
      Parameters:
      key - the key
      Returns:
      the old value for the given key.
    • getNewValue

      public abstract V getNewValue(Object key)
      Returns the new value for the given key, which must be an element of getChangedKeys() or getAddedKeys().
      Parameters:
      key - the key
      Returns:
      the new value for the given key.