Interface MergeMap<K,V>

All Superinterfaces:
Map<K,V>
All Known Implementing Classes:
DefaultMergeMap

public interface MergeMap<K,V> extends Map<K,V>
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().
  • 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

      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 key
      value - - 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 map
      mergeFunction - - 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 key
      value - - 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 map
      mergeFunction - - the merge function
    • orderedValues

      List<V> orderedValues()
      Returns an ordered List of the values contained in this map.
      Returns:
      an ordered List of the values contained in this map