Package one.nio.mem
Class LongHashSet
- java.lang.Object
-
- one.nio.mem.LongHashSet
-
- Direct Known Subclasses:
LongLongHashMap,LongObjectHashMap
public class LongHashSet extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LongHashSet(int capacity)LongHashSet(int capacity, long keys)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private intcalculateSize()intcapacity()voidclear()This method is not atomic and must not be invoked concurrently with other modification methods (e.g.,putKey(long)orremoveKey(long))protected voiddecrementSize()intgetKey(long key)protected static inthash(long key)protected voidincrementSize()longkeyAt(int index)intputKey(long key)intremoveKey(long key)voidsetKeyAt(int index, long value)intsize()static longsizeInBytes(int capacity)
-
-
-
Field Detail
-
unsafe
protected static final sun.misc.Unsafe unsafe
-
sizeOffset
protected static final long sizeOffset
-
EMPTY
public static final long EMPTY
- See Also:
- Constant Field Values
-
REMOVED
public static final long REMOVED
- See Also:
- Constant Field Values
-
size
protected volatile int size
-
capacity
protected int capacity
-
maxSteps
protected int maxSteps
-
keys
protected long keys
-
-
Method Detail
-
size
public final int size()
-
capacity
public final int capacity()
-
getKey
public final int getKey(long key)
-
putKey
public final int putKey(long key)
-
removeKey
public final int removeKey(long key)
-
keyAt
public final long keyAt(int index)
-
setKeyAt
public final void setKeyAt(int index, long value)
-
clear
public void clear()
This method is not atomic and must not be invoked concurrently with other modification methods (e.g.,putKey(long)orremoveKey(long))
-
incrementSize
protected void incrementSize()
-
decrementSize
protected void decrementSize()
-
calculateSize
private int calculateSize()
-
hash
protected static int hash(long key)
-
sizeInBytes
public static long sizeInBytes(int capacity)
-
-