Interface MergeMap<K,V>
- All Superinterfaces:
Map<K,V>
- All Known Implementing Classes:
DefaultMergeMap
A
Map that provides additional merge operations. Due to performance reasons the map does not provide
predictable iteration order, however it is possible to get an ordered list of values by calling
orderedValues().-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the highest rank of the values in the map.intReturns the lowest rank of the values in the map.voidmergeAfter(MergeMap<K, V> source, MergeFunction<K, V> mergeFunction) Merges both maps, all entries from source map are added to this map.mergeAfter(K key, V value) Associates the given value with the given key in this map.voidmergeBefore(MergeMap<K, V> source, MergeFunction<K, V> mergeFunction) Merges both maps, all entries from source map are added to this map.mergeBefore(K key, V value) Associates the given value with the given key in this map.Returns an orderedListof the values contained in this map.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getHighestRank
int getHighestRank()Returns the highest rank of the values in the map.- Returns:
- the highest rank of the values in the map
-
getLowestRank
int getLowestRank()Returns the lowest rank of the values in the map.- Returns:
- the lowest rank of the values in the map
-
mergeBefore
Associates the given value with the given key in this map. The new value is added with an higher rank.- Parameters:
key- - the keyvalue- - the value- Returns:
- the previous value, or null if there was no mapping for the key
-
mergeBefore
Merges both maps, all entries from source map are added to this map. The new values are added with an higher rank, the rank hierarchy from the source map is preserved. If the merge function returns null, the mapping is removed.- Parameters:
source- - the source mapmergeFunction- - the merge function
-
mergeAfter
Associates the given value with the given key in this map. The new value is added with a lower rank.- Parameters:
key- - the keyvalue- - the value- Returns:
- the previous value, or null if there was no mapping for the key
-
mergeAfter
Merges both maps, all entries from source map are added to this map. The new values are added with a lower rank, the rank hierarchy from the source map is preserved. If the merge function returns null, the mapping is removed.- Parameters:
source- - the source mapmergeFunction- - the merge function
-
orderedValues
Returns an orderedListof the values contained in this map.- Returns:
- an ordered
Listof the values contained in this map
-