V
- The value type stored in the map.public class LongObjectHashMap<V> extends java.lang.Object implements LongObjectMap<V>
LongObjectMap
that uses open addressing for keys.
To minimize the memory footprint, this class uses open addressing rather than chaining.
Collisions are resolved using linear probing. Deletions implement compaction, so cost of
remove can approach O(N) for full maps, which makes a small loadFactor recommended.LongObjectMap.PrimitiveEntry<V>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CAPACITY
Default initial capacity.
|
static float |
DEFAULT_LOAD_FACTOR
Default load factor.
|
Constructor and Description |
---|
LongObjectHashMap() |
LongObjectHashMap(int initialCapacity) |
LongObjectHashMap(int initialCapacity,
float loadFactor) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(long key)
Indicates whether or not this map contains a value for the specified key.
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.lang.Iterable<LongObjectMap.PrimitiveEntry<V>> |
entries()
Gets an iterable to traverse over the primitive entries contained in this map.
|
java.util.Set<java.util.Map.Entry<java.lang.Long,V>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
V |
get(long key)
Gets the value in the map with the specified key.
|
V |
get(java.lang.Object key) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<java.lang.Long> |
keySet() |
protected java.lang.String |
keyToString(long key)
Helper method called by
toString() in order to convert a single map key into a string. |
V |
put(long key,
V value)
Puts the given entry into the map.
|
V |
put(java.lang.Long key,
V value) |
void |
putAll(java.util.Map<? extends java.lang.Long,? extends V> sourceMap) |
V |
remove(long key)
Removes the entry with the specified key.
|
V |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<V> |
values() |
public static final int DEFAULT_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
public LongObjectHashMap()
public LongObjectHashMap(int initialCapacity)
public LongObjectHashMap(int initialCapacity, float loadFactor)
public V get(long key)
LongObjectMap
get
in interface LongObjectMap<V>
key
- the key whose associated value is to be returned.null
if the key was not found in the map.public V put(long key, V value)
LongObjectMap
put
in interface LongObjectMap<V>
key
- the key of the entry.value
- the value of the entry.null
if there was no previous mapping.public void putAll(java.util.Map<? extends java.lang.Long,? extends V> sourceMap)
putAll
in interface java.util.Map<java.lang.Long,V>
public V remove(long key)
LongObjectMap
remove
in interface LongObjectMap<V>
key
- the key for the entry to be removed from this map.null
if there was no mapping.public int size()
size
in interface java.util.Map<java.lang.Long,V>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.Long,V>
public void clear()
clear
in interface java.util.Map<java.lang.Long,V>
public boolean containsKey(long key)
LongObjectMap
containsKey
in interface LongObjectMap<V>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.Long,V>
public java.lang.Iterable<LongObjectMap.PrimitiveEntry<V>> entries()
LongObjectMap
LongObjectMap.PrimitiveEntry
s returned by the Iterator
may change as the Iterator
progresses. The caller should not rely on LongObjectMap.PrimitiveEntry
key/value stability.entries
in interface LongObjectMap<V>
public java.util.Collection<V> values()
values
in interface java.util.Map<java.lang.Long,V>
public int hashCode()
hashCode
in interface java.util.Map<java.lang.Long,V>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map<java.lang.Long,V>
equals
in class java.lang.Object
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.Long,V>
public V get(java.lang.Object key)
get
in interface java.util.Map<java.lang.Long,V>
public V put(java.lang.Long key, V value)
put
in interface java.util.Map<java.lang.Long,V>
public V remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.Long,V>
public java.util.Set<java.lang.Long> keySet()
keySet
in interface java.util.Map<java.lang.Long,V>
public java.util.Set<java.util.Map.Entry<java.lang.Long,V>> entrySet()
entrySet
in interface java.util.Map<java.lang.Long,V>
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String keyToString(long key)
toString()
in order to convert a single map key into a string.
This is protected to allow subclasses to override the appearance of a given key.Copyright © 2008–2019 The Netty Project. All rights reserved.