Module org.apache.lucene.sandbox
Class LongValueFacetCutter.LongIntHashMapSyncCompute
java.lang.Object
org.apache.lucene.internal.hppc.LongIntHashMap
org.apache.lucene.sandbox.facet.cutters.LongValueFacetCutter.LongIntHashMapSyncCompute
- All Implemented Interfaces:
Cloneable
,Iterable<LongIntHashMap.LongIntCursor>
,Accountable
- Enclosing class:
LongValueFacetCutter
LongIntHashMap
with threadsafe computeIfAbsent method-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.internal.hppc.LongIntHashMap
LongIntHashMap.KeysContainer, LongIntHashMap.LongIntCursor, LongIntHashMap.ValuesContainer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Lock
private final ReentrantReadWriteLock
private final Lock
Fields inherited from class org.apache.lucene.internal.hppc.LongIntHashMap
assigned, hasEmptyKey, iterationSeed, keys, loadFactor, mask, resizeAt, values
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
computeIfAbsent
(long key, IntSupplier valueSupplier) If key exists in the map return its value, otherwise insert value from the value supplier and return it.Methods inherited from class org.apache.lucene.internal.hppc.LongIntHashMap
addTo, allocateBuffers, allocateThenInsertThenRehash, clear, clone, containsKey, ensureCapacity, equalElements, equals, from, get, getOrDefault, hashCode, hashKey, indexExists, indexGet, indexInsert, indexOf, indexRemove, indexReplace, isEmpty, iterator, keys, nextIterationSeed, put, putAll, putIfAbsent, putOrAdd, ramBytesUsed, rehash, release, remove, shiftConflictingKeys, size, toString, values, verifyLoadFactor
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
rwl
-
r
-
w
-
-
Constructor Details
-
LongIntHashMapSyncCompute
private LongIntHashMapSyncCompute()
-
-
Method Details
-
computeIfAbsent
If key exists in the map return its value, otherwise insert value from the value supplier and return it.The method is threadsafe, and it allows concurrent reading from the map, but it locks the map to insert a new value as it might require rehashing.
-