Package de.xima.fc.workflow.model
Class MapDiff<K,V>
- java.lang.Object
-
- de.xima.fc.workflow.model.MapDiff<K,V>
-
- Type Parameters:
K
- Type of the map's keys.V
- Type of the map's values.
- All Implemented Interfaces:
IMapDiff<K,V>
,Serializable
public class MapDiff<K,V> extends Object implements IMapDiff<K,V>
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.xima.fc.interfaces.IMapDiff
IMapDiff.IModifiedValue<V>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.static <K,V>
IMapDiff<K,V>betweenMaps(Map<K,V> oldMap, Map<K,V> newMap)
Computes and returns the difference between twoMap
s.static <K,V>
IMapDiff<K,V>empty()
boolean
equals(Object obj)
Map<K,V>
getAddedEntries()
Map<K,IMapDiff.IModifiedValue<V>>
getModifiedEntries()
Map<K,V>
getRemovedEntries()
int
hashCode()
-
-
-
Method Detail
-
applyBackward
public void applyBackward(Map<K,V> map)
Description copied from interface:IMapDiff
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.- Specified by:
applyBackward
in interfaceIMapDiff<K,V>
- Parameters:
map
- Map to modify.
-
applyForward
public void applyForward(Map<? super K,? super V> map)
Description copied from interface:IMapDiff
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.- Specified by:
applyForward
in interfaceIMapDiff<K,V>
- Parameters:
map
- Map to modify.
-
getAddedEntries
public Map<K,V> getAddedEntries()
- Specified by:
getAddedEntries
in interfaceIMapDiff<K,V>
- Returns:
- A map with the keys of the newly added entries, and the new value for each key.
-
getModifiedEntries
public Map<K,IMapDiff.IModifiedValue<V>> getModifiedEntries()
- Specified by:
getModifiedEntries
in interfaceIMapDiff<K,V>
- Returns:
- A map with the keys of the modified entries, together with the old and new value for each key.
-
getRemovedEntries
public Map<K,V> getRemovedEntries()
- Specified by:
getRemovedEntries
in interfaceIMapDiff<K,V>
- Returns:
- A map with the keys of the removed entries, and the old value for each key.
-
betweenMaps
public static <K,V> IMapDiff<K,V> betweenMaps(Map<K,V> oldMap, Map<K,V> newMap)
Computes and returns the difference between twoMap
s.- Type Parameters:
K
- Type of the map's keys.V
- Type of the map's values.- Parameters:
oldMap
- Previous map.newMap
- New map.- Returns:
- The diff between the two maps.
-
empty
public static <K,V> IMapDiff<K,V> empty()
- Returns:
- A diff with no entries (no added, removed, or modified entries).
-
-