Class LongHashMap<T>
- java.lang.Object
-
- org.greenrobot.essentials.collections.LongHashMap<T>
-
- Type Parameters:
T- The value class to store.
- Direct Known Subclasses:
LongHashMap.Synchronized
public class LongHashMap<T> extends java.lang.ObjectAn minimalistic hash map optimized for long keys. The default implementation is not thread-safe, but you can get a synchronized variant using one of the static createSynchronized methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLongHashMap.Entry<T>protected static classLongHashMap.Synchronized<T>
-
Field Summary
Fields Modifier and Type Field Description private intcapacityprotected static intDEFAULT_CAPACITYprivate intsizeprivate LongHashMap.Entry<T>[]tableprivate intthreshold
-
Constructor Summary
Constructors Constructor Description LongHashMap()LongHashMap(int capacity)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(long key)static <T> LongHashMap<T>createSynchronized()Creates a synchronized (thread-safe) LongHashSet.static <T> LongHashMap<T>createSynchronized(int capacity)Creates a synchronized (thread-safe) LongHashSet using the given initial capacity.LongHashMap.Entry<T>[]entries()Returns all entries in no particular order.Tget(long key)long[]keys()Returns all keys in no particular order.Tput(long key, T value)Tremove(long key)voidreserveRoom(int entryCount)Target load: 0,6voidsetCapacity(int newCapacity)intsize()
-
-
-
Field Detail
-
DEFAULT_CAPACITY
protected static final int DEFAULT_CAPACITY
- See Also:
- Constant Field Values
-
table
private LongHashMap.Entry<T>[] table
-
capacity
private int capacity
-
threshold
private int threshold
-
size
private volatile int size
-
-
Method Detail
-
createSynchronized
public static <T> LongHashMap<T> createSynchronized()
Creates a synchronized (thread-safe) LongHashSet.
-
createSynchronized
public static <T> LongHashMap<T> createSynchronized(int capacity)
Creates a synchronized (thread-safe) LongHashSet using the given initial capacity.
-
containsKey
public boolean containsKey(long key)
-
get
public T get(long key)
-
remove
public T remove(long key)
-
keys
public long[] keys()
Returns all keys in no particular order.
-
entries
public LongHashMap.Entry<T>[] entries()
Returns all entries in no particular order.
-
clear
public void clear()
-
size
public int size()
-
setCapacity
public void setCapacity(int newCapacity)
-
reserveRoom
public void reserveRoom(int entryCount)
Target load: 0,6
-
-