Module org.elasticsearch.server
Package org.elasticsearch.common.util
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionObjectObjectPagedHashMap
(long capacity, float maxLoadFactor, BigArrays bigArrays) ObjectObjectPagedHashMap
(long capacity, BigArrays bigArrays) -
Method Summary
Modifier and TypeMethodDescriptionlong
capacity()
Return the number of allocated slots to store this hash table.void
close()
Get the value that is associated withkey
or null ifkey
was not present in the hash table.protected final void
grow()
iterator()
Put this new (key, value) pair into this hash table and return the value that was previously associated withkey
or null in case of an insertion.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.protected void
removeAndAdd
(long index) Remove the entry at the given index and add it backprotected void
resize
(long capacity) Resize to the given capacity.long
size()
Return the number of longs in this hash table.protected boolean
used
(long bucket) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ObjectObjectPagedHashMap
-
ObjectObjectPagedHashMap
-
-
Method Details
-
get
Get the value that is associated withkey
or null ifkey
was not present in the hash table. -
put
Put this new (key, value) pair into this hash table and return the value that was previously associated withkey
or null in case of an insertion. -
remove
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
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceReleasable
-
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()
-