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>
    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

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getHighestRank()
      Returns the highest rank of the values in the map.
      int getLowestRank()
      Returns the lowest rank of the values in the map.
      void mergeAfter​(MergeMap<K,​V> source, MergeFunction<K,​V> mergeFunction)
      Merges both maps, all entries from source map are added to this map.
      V mergeAfter​(K key, V value)
      Associates the given value with the given key in this map.
      void mergeBefore​(MergeMap<K,​V> source, MergeFunction<K,​V> mergeFunction)
      Merges both maps, all entries from source map are added to this map.
      V mergeBefore​(K key, V value)
      Associates the given value with the given key in this map.
      java.util.List<V> orderedValues()
      Returns an ordered List of 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 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 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

        java.util.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