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 mapV
- the type of mapped values
- All Implemented Interfaces:
IDiff
- Since:
- 1.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Applies the changes in this diff to the given mapabstract V
getNewValue
(Object key) Returns the new value for the given key, which must be an element ofgetChangedKeys()
orgetAddedKeys()
.abstract V
getOldValue
(Object key) Returns the old value for the given key, which must be an element ofgetRemovedKeys()
orgetChangedKeys()
.boolean
isEmpty()
Returns true if the diff has no added, removed or changed entries.simulateOn
(Map<K, V> map) Returns a map showing whatmap
would look like if this diff were applied to it.
-
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
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
Returns a map showing whatmap
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 theapplyTo(Map)
method. - Since:
- 1.3
- See Also:
-
getAddedKeys
- Returns:
- the set of keys which were added
-
getRemovedKeys
- Returns:
- the set of keys which were removed
-
getChangedKeys
- Returns:
- the set of keys for which the value has changed
-
getOldValue
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
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.
-