public final class LongHash extends Object
BigArrays and capacity is always
a multiple of 2 for faster identification of buckets.
This class is not thread-safe.| Constructor and Description |
|---|
LongHash(long capacity,
BigArrays bigArrays) |
LongHash(long capacity,
float maxLoadFactor,
BigArrays bigArrays) |
| Modifier and Type | Method and Description |
|---|---|
long |
add(long key)
Try to add
key. |
long |
capacity()
Return the number of allocated slots to store this hash table.
|
void |
close() |
long |
find(long key)
Get the id associated with
key |
long |
get(long id)
Return the key at
0 <e; index <e; capacity(). |
protected void |
grow() |
long |
id(long index)
Get the id associated with key at
0 <= index <= capacity() or -1 if this slot is unused. |
protected long |
id(long index,
long id) |
protected void |
removeAndAdd(long index)
Remove the entry at the given index and add it back
|
protected 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) |
public LongHash(long capacity,
BigArrays bigArrays)
public LongHash(long capacity,
float maxLoadFactor,
BigArrays bigArrays)
public long get(long id)
0 <e; index <e; capacity(). The result is undefined if the slot is unused.public long find(long key)
keypublic long add(long key)
key. Return its newly allocated id if it wasn't in the hash table yet, or -1-id
if it was already present in the hash table.protected void removeAndAdd(long index)
public void close()
close in interface AutoCloseableclose in interface Releasablepublic long id(long index)
0 <= index <= capacity() or -1 if this slot is unused.protected final long id(long index,
long id)
protected void resize(long capacity)
protected boolean used(long bucket)
public long capacity()
public long size()
protected final void grow()
Copyright © 2009–2016. All rights reserved.