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.Object
An 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 class
LongHashMap.Entry<T>
protected static class
LongHashMap.Synchronized<T>
-
Field Summary
Fields Modifier and Type Field Description private int
capacity
protected static int
DEFAULT_CAPACITY
private int
size
private LongHashMap.Entry<T>[]
table
private int
threshold
-
Constructor Summary
Constructors Constructor Description LongHashMap()
LongHashMap(int capacity)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
containsKey(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.T
get(long key)
long[]
keys()
Returns all keys in no particular order.T
put(long key, T value)
T
remove(long key)
void
reserveRoom(int entryCount)
Target load: 0,6void
setCapacity(int newCapacity)
int
size()
-
-
-
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
-
-