Class ConcurrentLongLongPairHashMap
- java.lang.Object
-
- org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap
-
public class ConcurrentLongLongPairHashMap extends java.lang.Object
Concurrent hash map where both keys and values are composed of pairs of longs.(long,long) --> (long,long)
Provides similar methods as a
ConcurrentMap<K,V>
but since it's an open hash map with linear probing, no node allocations are required to store the keys and values, and no boxing is required.Keys MUST be >= 0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ConcurrentLongLongPairHashMap.BiConsumerLongPair
A BiConsumer Long pair.static class
ConcurrentLongLongPairHashMap.Builder
Builder of ConcurrentLongLongPairHashMap.static interface
ConcurrentLongLongPairHashMap.LongLongPairFunction
A Long pair function.static interface
ConcurrentLongLongPairHashMap.LongLongPairPredicate
A Long pair predicate.static class
ConcurrentLongLongPairHashMap.LongPair
A pair of long values.
-
Constructor Summary
Constructors Constructor Description ConcurrentLongLongPairHashMap()
Deprecated.ConcurrentLongLongPairHashMap(int expectedItems)
Deprecated.ConcurrentLongLongPairHashMap(int expectedItems, int concurrencyLevel)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<ConcurrentLongLongPairHashMap.LongPair,ConcurrentLongLongPairHashMap.LongPair>
asMap()
long
capacity()
void
clear()
boolean
containsKey(long key1, long key2)
void
forEach(ConcurrentLongLongPairHashMap.BiConsumerLongPair processor)
ConcurrentLongLongPairHashMap.LongPair
get(long key1, long key2)
(package private) long
getUsedBucketCount()
(package private) static long
hash(long key1, long key2)
boolean
isEmpty()
java.util.List<ConcurrentLongLongPairHashMap.LongPair>
keys()
static ConcurrentLongLongPairHashMap.Builder
newBuilder()
boolean
put(long key1, long key2, long value1, long value2)
boolean
putIfAbsent(long key1, long key2, long value1, long value2)
boolean
remove(long key1, long key2)
Remove an existing entry if found.boolean
remove(long key1, long key2, long value1, long value2)
(package private) static int
signSafeMod(long n, int max)
long
size()
java.util.List<ConcurrentLongLongPairHashMap.LongPair>
values()
-
-
-
Constructor Detail
-
ConcurrentLongLongPairHashMap
@Deprecated public ConcurrentLongLongPairHashMap()
Deprecated.
-
ConcurrentLongLongPairHashMap
@Deprecated public ConcurrentLongLongPairHashMap(int expectedItems)
Deprecated.
-
ConcurrentLongLongPairHashMap
@Deprecated public ConcurrentLongLongPairHashMap(int expectedItems, int concurrencyLevel)
Deprecated.
-
-
Method Detail
-
newBuilder
public static ConcurrentLongLongPairHashMap.Builder newBuilder()
-
size
public long size()
-
capacity
public long capacity()
-
isEmpty
public boolean isEmpty()
-
getUsedBucketCount
long getUsedBucketCount()
-
get
public ConcurrentLongLongPairHashMap.LongPair get(long key1, long key2)
- Parameters:
key
-- Returns:
- the value or -1 if the key was not present
-
containsKey
public boolean containsKey(long key1, long key2)
-
put
public boolean put(long key1, long key2, long value1, long value2)
-
putIfAbsent
public boolean putIfAbsent(long key1, long key2, long value1, long value2)
-
remove
public boolean remove(long key1, long key2)
Remove an existing entry if found.- Parameters:
key
-- Returns:
- the value associated with the key or -1 if key was not present
-
remove
public boolean remove(long key1, long key2, long value1, long value2)
-
clear
public void clear()
-
forEach
public void forEach(ConcurrentLongLongPairHashMap.BiConsumerLongPair processor)
-
keys
public java.util.List<ConcurrentLongLongPairHashMap.LongPair> keys()
- Returns:
- a new list of all keys (makes a copy)
-
values
public java.util.List<ConcurrentLongLongPairHashMap.LongPair> values()
-
asMap
public java.util.Map<ConcurrentLongLongPairHashMap.LongPair,ConcurrentLongLongPairHashMap.LongPair> asMap()
-
hash
static final long hash(long key1, long key2)
-
signSafeMod
static final int signSafeMod(long n, int max)
-
-