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

private static class LongValueFacetCutter.LongIntHashMapSyncCompute extends LongIntHashMap
LongIntHashMap with threadsafe computeIfAbsent method
  • Field Details

  • Constructor Details

    • LongIntHashMapSyncCompute

      private LongIntHashMapSyncCompute()
  • Method Details

    • computeIfAbsent

      public int computeIfAbsent(long key, IntSupplier valueSupplier)
      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.