类 ConcurrentLongLongPairHashMap
(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.
WARN: method forEach do not guarantee thread safety, nor do the keys, values and asMap method.
The forEach method is specifically designed for single-threaded usage. When iterating over a map
with concurrent writes, it becomes possible for new values to be either observed or not observed.
There is no guarantee that if we write value1 and value2, and are able to see value2, then we will also see value1.
In some cases, it is even possible to encounter two mappings with the same key,
leading the keys method to return a List containing two identical keys.
It is crucial to understand that the results obtained from aggregate status methods such as keys, values, and asMap
are typically reliable only when the map is not undergoing concurrent updates from other threads.
When concurrent updates are involved, the results of these methods reflect transient states
that may be suitable for monitoring or estimation purposes, but not for program control.
-
嵌套类概要
嵌套类修饰符和类型类说明static interfaceA BiConsumer Long pair.static classBuilder of ConcurrentLongLongPairHashMap.static interfaceA Long pair function.static interfaceA Long pair predicate.static classA pair of long values. -
方法概要
修饰符和类型方法说明asMap()longcapacity()voidclear()booleancontainsKey(long key1, long key2) voidIterate over all the entries in the map and apply the processor function to each of them.get(long key1, long key2) booleanisEmpty()keys()booleanput(long key1, long key2, long value1, long value2) booleanputIfAbsent(long key1, long key2, long value1, long value2) booleanremove(long key1, long key2) Remove an existing entry if found.booleanremove(long key1, long key2, long value1, long value2) longsize()values()
-
方法详细资料
-
newBuilder
-
size
public long size() -
capacity
public long capacity() -
isEmpty
public boolean isEmpty() -
get
- 参数:
key1-key2-- 返回:
- 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.- 参数:
key1-key2-- 返回:
- 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
Iterate over all the entries in the map and apply the processor function to each of them.Warning: Do Not Guarantee Thread-Safety.
- 参数:
processor- the processor to process the elements.
-
keys
- 返回:
- a new list of all keys (makes a copy).
-
values
-
asMap
-