Class ObjectObjectPagedHashMap<K,V>

java.lang.Object
org.elasticsearch.common.util.ObjectObjectPagedHashMap<K,V>
All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ObjectObjectPagedHashMap.Cursor<K,V>>, Releasable

public final class ObjectObjectPagedHashMap<K,V> extends Object implements Iterable<ObjectObjectPagedHashMap.Cursor<K,V>>
A hash table from objects to objects. This implementation resolves collisions with open addressing and linear probing and does not support null values. This class is not thread-safe. Note that this class does not track either the actual keys or values. It is responsibility of the caller to release those objects if necessary.
  • Constructor Details

    • ObjectObjectPagedHashMap

      public ObjectObjectPagedHashMap(long capacity, BigArrays bigArrays)
    • ObjectObjectPagedHashMap

      public ObjectObjectPagedHashMap(long capacity, float maxLoadFactor, BigArrays bigArrays)
  • Method Details

    • get

      public V get(K key)
      Get the value that is associated with key or null if key was not present in the hash table.
    • put

      public V put(K key, V value)
      Put this new (key, value) pair into this hash table and return the value that was previously associated with key or null in case of an insertion.
    • remove

      public V remove(K key)
      Remove the entry which has this key in the hash table and return the associated value or null if there was no entry associated with this key.
    • iterator

      Specified by:
      iterator in interface Iterable<K>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Releasable
    • resize

      protected void resize(long capacity)
      Resize to the given capacity.
    • used

      protected boolean used(long bucket)
    • removeAndAdd

      protected void removeAndAdd(long index)
      Remove the entry at the given index and add it back
    • capacity

      public long capacity()
      Return the number of allocated slots to store this hash table.
    • size

      public long size()
      Return the number of longs in this hash table.
    • grow

      protected final void grow()