Package org.elasticsearch.common.util
Class LongObjectPagedHashMap<T>
java.lang.Object
org.elasticsearch.common.util.LongObjectPagedHashMap<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<LongObjectPagedHashMap.Cursor<T>>,org.elasticsearch.core.Releasable
public class LongObjectPagedHashMap<T>
extends Object
implements Iterable<LongObjectPagedHashMap.Cursor<T>>
A hash table from native longs to objects. This implementation resolves collisions
using open-addressing and does not support null values. This class is not thread-safe.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLongObjectPagedHashMap(long capacity, float maxLoadFactor, BigArrays bigArrays)LongObjectPagedHashMap(long capacity, BigArrays bigArrays) -
Method Summary
Modifier and TypeMethodDescriptionlongcapacity()Return the number of allocated slots to store this hash table.voidclose()get(long key)Get the value that is associated withkeyor null ifkeywas not present in the hash table.protected voidgrow()iterator()Put this new (key, value) pair into this hash table and return the value that was previously associated withkeyor null in case of an insertion.remove(long 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.protected voidremoveAndAdd(long index)Remove the entry at the given index and add it backprotected voidresize(long capacity)Resize to the given capacity.longsize()Return the number of longs in this hash table.protected booleanused(long bucket)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
LongObjectPagedHashMap
-
LongObjectPagedHashMap
-
-
Method Details
-
get
Get the value that is associated withkeyor null ifkeywas 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 withkeyor 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceorg.elasticsearch.core.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()
-