Interface MergeMap<K,V>
-
- All Superinterfaces:
java.util.Map<K,V>
- All Known Implementing Classes:
DefaultMergeMap
public interface MergeMap<K,V> extends java.util.Map<K,V>AMapthat 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 callingorderedValues().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetHighestRank()Returns the highest rank of the values in the map.intgetLowestRank()Returns 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.VmergeAfter(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.VmergeBefore(K key, V value)Associates the given value with the given key in this map.java.util.List<V>orderedValues()Returns an orderedListof the values contained in this map.
-
-
-
Method Detail
-
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
V mergeBefore(K key, V value)
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
void mergeBefore(MergeMap<K,V> source, MergeFunction<K,V> mergeFunction)
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
V mergeAfter(K key, V value)
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
void mergeAfter(MergeMap<K,V> source, MergeFunction<K,V> mergeFunction)
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
java.util.List<V> orderedValues()
Returns an orderedListof the values contained in this map.- Returns:
- an ordered
Listof the values contained in this map
-
-