Class MapDiff<K,V>
- java.lang.Object
-
- org.eclipse.core.databinding.observable.map.MapDiff<K,V>
-
-
Constructor Summary
Constructors Constructor Description MapDiff()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidapplyTo(java.util.Map<? super K,? super V> map)Applies the changes in this diff to the given mapabstract java.util.Set<K>getAddedKeys()abstract java.util.Set<K>getChangedKeys()abstract VgetNewValue(java.lang.Object key)Returns the new value for the given key, which must be an element ofgetChangedKeys()orgetAddedKeys().abstract VgetOldValue(java.lang.Object key)Returns the old value for the given key, which must be an element ofgetRemovedKeys()orgetChangedKeys().abstract java.util.Set<K>getRemovedKeys()booleanisEmpty()Returns true if the diff has no added, removed or changed entries.java.util.Map<K,V>simulateOn(java.util.Map<K,V> map)Returns a map showing whatmapwould look like if this diff were applied to it.
-
-
-
Method Detail
-
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(java.util.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 java.util.Map<K,V> simulateOn(java.util.Map<K,V> map)
Returns a map showing whatmapwould 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
mapwould look like if it were passed to theapplyTo(Map)method. - Since:
- 1.3
- See Also:
applyTo(Map)
-
getAddedKeys
public abstract java.util.Set<K> getAddedKeys()
- Returns:
- the set of keys which were added
-
getRemovedKeys
public abstract java.util.Set<K> getRemovedKeys()
- Returns:
- the set of keys which were removed
-
getChangedKeys
public abstract java.util.Set<K> getChangedKeys()
- Returns:
- the set of keys for which the value has changed
-
getOldValue
public abstract V getOldValue(java.lang.Object key)
Returns the old value for the given key, which must be an element ofgetRemovedKeys()orgetChangedKeys().- Parameters:
key- the key- Returns:
- the old value for the given key.
-
getNewValue
public abstract V getNewValue(java.lang.Object key)
Returns the new value for the given key, which must be an element ofgetChangedKeys()orgetAddedKeys().- Parameters:
key- the key- Returns:
- the new value for the given key.
-
-