Package alluxio.collections
Class TwoKeyConcurrentMap<K1,K2,V,M extends java.util.Map<K2,V>>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.concurrent.ConcurrentHashMap<K1,M>
-
- alluxio.collections.TwoKeyConcurrentMap<K1,K2,V,M>
-
- Type Parameters:
K1
- the first key typeK2
- the second key typeV
- the value typeM
- 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>
-
-
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
-
-
-
-
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 keyk2
- the second keyv
- the value
-
removeInnerValue
@Nullable public void removeInnerValue(K1 k1, K2 k2)
- Parameters:
k1
- the first keyk2
- 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.
-
-