Class TwoKeyConcurrentMap<K1,​K2,​V,​M extends java.util.Map<K2,​V>>

  • Type Parameters:
    K1 - the first key type
    K2 - the second key type
    V - the value type
    M - the type for the inner map
    All Implemented Interfaces:
    java.io.Serializable, java.util.concurrent.ConcurrentMap<K1,​M>, java.util.Map<K1,​M>
    Direct Known Subclasses:
    TwoKeyConcurrentSortedMap

    public class TwoKeyConcurrentMap<K1,​K2,​V,​M extends java.util.Map<K2,​V>>
    extends java.util.concurrent.ConcurrentHashMap<K1,​M>
    A two-level concurrent map implementation. Concurrent usage is managed by the outer map. Users can supply the inner map type of their choice.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  TwoKeyConcurrentMap.TriFunction<A,​B,​C,​R>
      A function with three arguments.
      • Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap

        java.util.concurrent.ConcurrentHashMap.KeySetView<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

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

      Constructors 
      Constructor Description
      TwoKeyConcurrentMap​(java.util.function.Supplier<M> innerMapCreator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addInnerValue​(K1 k1, K2 k2, V v)  
      boolean equals​(java.lang.Object o)
      The equals implementation for this map simply uses the superclass's equals.
      <R> java.util.Set<R> flattenEntries​(TwoKeyConcurrentMap.TriFunction<K1,​K2,​V,​R> fn)
      Flattens the (key1, key2, value) triples according to the given function.
      int hashCode()
      The hashCode implementation for this map simply uses the superclass's.
      void removeInnerValue​(K1 k1, K2 k2)  
      • Methods inherited from class java.util.concurrent.ConcurrentHashMap

        clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
      • Methods inherited from class java.util.AbstractMap

        clone
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TwoKeyConcurrentMap

        public TwoKeyConcurrentMap​(java.util.function.Supplier<M> innerMapCreator)
        Parameters:
        innerMapCreator - supplier for the inner map type
    • Method Detail

      • addInnerValue

        public void addInnerValue​(K1 k1,
                                  K2 k2,
                                  V v)
        Parameters:
        k1 - the first key
        k2 - the second key
        v - the value
      • removeInnerValue

        @Nullable
        public void removeInnerValue​(K1 k1,
                                     K2 k2)
        Parameters:
        k1 - the first key
        k2 - the second key
      • flattenEntries

        public <R> java.util.Set<R> flattenEntries​(TwoKeyConcurrentMap.TriFunction<K1,​K2,​V,​R> fn)
        Flattens the (key1, key2, value) triples according to the given function.
        Type Parameters:
        R - the result type of the function
        Parameters:
        fn - a function to create an entry from the keys and value
        Returns:
        the set of entries
      • equals

        public boolean equals​(java.lang.Object o)
        The equals implementation for this map simply uses the superclass's equals.
        Specified by:
        equals in interface java.util.Map<K1,​K2>
        Overrides:
        equals in class java.util.concurrent.ConcurrentHashMap<K1,​M extends java.util.Map<K2,​V>>
      • hashCode

        public int hashCode()
        The hashCode implementation for this map simply uses the superclass's.
        Specified by:
        hashCode in interface java.util.Map<K1,​K2>
        Overrides:
        hashCode in class java.util.concurrent.ConcurrentHashMap<K1,​M extends java.util.Map<K2,​V>>