|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mapdb.LongMap<V>
org.mapdb.LongHashMap<V>
public class LongHashMap<V>
LongHashMap is an implementation of LongMap without concurrency locking. This code is adoption of 'HashMap' from Apache Harmony refactored to support primitive long keys.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.mapdb.LongMap |
|---|
LongMap.LongMapIterator<V> |
| Field Summary | |
|---|---|
protected long |
hashSalt
Salt added to keys before hashing, so it is harder to trigger hash collision attack. |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
void |
clear()
Removes all mappings from this hash map, leaving it empty. |
V |
get(long key)
Returns the value of the mapping with the specified 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()
|
V |
put(long key,
V value)
Maps the specified key to the specified value. |
V |
remove(long key)
Removes the mapping with the specified key from this map. |
int |
size()
Returns the number of elements in this map. |
Iterator<V> |
valuesIterator()
|
| Methods inherited from class org.mapdb.LongMap |
|---|
toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final long hashSalt
| Constructor Detail |
|---|
public LongHashMap()
HashMap instance.
public LongHashMap(int capacity)
HashMap instance with the specified capacity.
capacity - the initial capacity of this hash map.
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.
IllegalArgumentException - when the capacity is less than zero or the load factor is
less or equal to zero.| Method Detail |
|---|
protected long hashSaltValue()
public void clear()
clear in class LongMap<V>isEmpty(),
size()public V get(long key)
get in class LongMap<V>key - the key.
null
if no mapping for the specified key is found.public boolean isEmpty()
isEmpty in class LongMap<V>true if this map has no elements, false
otherwise.size()
public V put(long key,
V value)
put in class LongMap<V>key - the key.value - the value.
null if there was no such mapping.public V remove(long key)
remove in class LongMap<V>key - the key of the mapping to remove.
null if no mapping
for the specified key was found.public int size()
size in class LongMap<V>public 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)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||