public class LongHashMap<V> extends LongMap<V> implements java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
private static class |
LongHashMap.AbstractMapIterator<V> |
(package private) static class |
LongHashMap.Entry<V> |
private static class |
LongHashMap.EntryIterator<V> |
private static class |
LongHashMap.ValueIterator<V> |
LongMap.LongMapIterator<V>| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_SIZE |
(package private) int |
elementCount |
(package private) LongHashMap.Entry<V>[] |
elementData |
protected long |
hashSalt
Salt added to keys before hashing, so it is harder to trigger hash collision attack.
|
(package private) float |
loadFactor |
(package private) int |
modCount |
private static long |
serialVersionUID |
(package private) int |
threshold |
| Constructor and Description |
|---|
LongHashMap()
Constructs a new empty
HashMap instance. |
LongHashMap(int capacity)
Constructs a new
HashMap instance with the specified capacity. |
LongHashMap(int capacity,
float loadFactor)
Constructs a new
HashMap instance with the specified capacity and
load factor. |
| Modifier and Type | Method and Description |
|---|---|
private static int |
calculateCapacity(int x)
Calculates the capacity of storage required for storing given number of
elements
|
void |
clear()
Removes all mappings from this hash map, leaving it empty.
|
private void |
computeThreshold()
Computes the threshold for rehashing
|
(package private) LongHashMap.Entry<V> |
createHashedEntry(long key,
int index,
int hash) |
(package private) LongHashMap.Entry<V> |
findNonNullKeyEntry(long key,
int index,
int keyHash) |
V |
get(long key)
Returns the value of the mapping with the specified key.
|
(package private) LongHashMap.Entry<V> |
getEntry(long key) |
protected long |
hashSaltValue() |
static int |
intHash(int h) |
boolean |
isEmpty()
Returns whether this map is empty.
|
static int |
longHash(long key) |
LongMap.LongMapIterator<V> |
longMapIterator() |
(package private) LongHashMap.Entry<V>[] |
newElementArray(int s)
Create a new element array
|
V |
put(long key,
V value)
Maps the specified key to the specified value.
|
(package private) void |
rehash() |
(package private) void |
rehash(int capacity) |
V |
remove(long key)
Removes the mapping with the specified key from this map.
|
(package private) LongHashMap.Entry<V> |
removeEntry(long key) |
int |
size()
Returns the number of elements in this map.
|
java.util.Iterator<V> |
valuesIterator() |
private static final long serialVersionUID
transient int elementCount
transient LongHashMap.Entry<V>[] elementData
transient int modCount
private static final int DEFAULT_SIZE
final float loadFactor
protected final long hashSalt
int threshold
public LongHashMap()
HashMap instance.public LongHashMap(int capacity)
HashMap instance with the specified capacity.capacity - the initial capacity of this hash map.java.lang.IllegalArgumentException - when the capacity is less than zero.public LongHashMap(int capacity,
float loadFactor)
HashMap instance with the specified capacity and
load factor.capacity - the initial capacity of this hash map.loadFactor - the initial load factor.java.lang.IllegalArgumentException - when the capacity is less than zero or the load factor is
less or equal to zero.protected long hashSaltValue()
LongHashMap.Entry<V>[] newElementArray(int s)
s - private static int calculateCapacity(int x)
x - number of elementspublic void clear()
private void computeThreshold()
public V get(long key)
final LongHashMap.Entry<V> getEntry(long key)
final LongHashMap.Entry<V> findNonNullKeyEntry(long key, int index, int keyHash)
public boolean isEmpty()
LongHashMap.Entry<V> createHashedEntry(long key, int index, int hash)
void rehash(int capacity)
void rehash()
public V remove(long key)
final LongHashMap.Entry<V> removeEntry(long key)
public int size()
public java.util.Iterator<V> valuesIterator()
valuesIterator in class LongMap<V>public LongMap.LongMapIterator<V> longMapIterator()
longMapIterator in class LongMap<V>public static int longHash(long key)
public static int intHash(int h)