Package de.xima.fc.interfaces
Interface IMapDiff<K,V>
- Type Parameters:
K
- Type of the map's keys.V
- Type of the map's values.
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
MapDiff
Represents the different between two
Map
s, i.e. when comparing two maps m1 and m2, which keys were removed,
which keys were added, and which values were changed.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Represents a value that was changed, used bygetModifiedEntries()
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyBackward
(Map<K, V> map) Applies the diff represented by this instance to the given map.void
applyForward
(Map<? super K, ? super V> map) Applies the diff represented by this instance to the given map.
-
Method Details
-
applyBackward
Applies the diff represented by this instance to the given map. If this is called on the map new map used to create the diff, this method turns it into the old map.- Parameters:
map
- Map to modify.
-
applyForward
Applies the diff represented by this instance to the given map. If this is called on the map old map used to create the diff, this method turns it into the new map.- Parameters:
map
- Map to modify.
-
getAddedEntries
- Returns:
- A map with the keys of the newly added entries, and the new value for each key.
-
getModifiedEntries
Map<K,IMapDiff.IModifiedValue<V>> getModifiedEntries()- Returns:
- A map with the keys of the modified entries, together with the old and new value for each key.
-
getRemovedEntries
- Returns:
- A map with the keys of the removed entries, and the old value for each key.
-