V - The value type stored in the map.public class IntObjectHashMap<V> extends java.lang.Object implements IntObjectMap<V>, java.lang.Iterable<IntObjectMap.Entry<V>>
IntObjectMap 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.IntObjectMap.Entry<V>| Constructor and Description |
|---|
IntObjectHashMap() |
IntObjectHashMap(int initialCapacity) |
IntObjectHashMap(int initialCapacity,
float loadFactor) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears all entries from this map.
|
boolean |
containsKey(int key)
Indicates whether or not this map contains a value for the specified key.
|
boolean |
containsValue(V value)
Indicates whether or not the map contains the specified value.
|
java.lang.Iterable<IntObjectMap.Entry<V>> |
entries()
Gets an iterable collection of the entries contained in this map.
|
boolean |
equals(java.lang.Object obj) |
V |
get(int key)
Gets the value in the map with the specified key.
|
int |
hashCode() |
boolean |
isEmpty()
Indicates whether or not this map is empty (i.e
IntObjectMap.size() == {@code 0]). |
java.util.Iterator<IntObjectMap.Entry<V>> |
iterator() |
int[] |
keys()
Gets the keys contained in this map.
|
protected java.lang.String |
keyToString(int key)
Helper method called by
toString() in order to convert a single map key into a string. |
V |
put(int key,
V value)
Puts the given entry into the map.
|
void |
putAll(IntObjectMap<V> sourceMap)
Puts all of the entries from the given map into this map.
|
V |
remove(int key)
Removes the entry with the specified key.
|
int |
size()
Returns the number of entries contained in this map.
|
java.lang.String |
toString() |
java.util.Collection<V> |
values()
Gets the values contatins in this map as a
Collection. |
V[] |
values(java.lang.Class<V> clazz)
Gets the values contained in this map.
|
public IntObjectHashMap()
public IntObjectHashMap(int initialCapacity)
public IntObjectHashMap(int initialCapacity,
float loadFactor)
public V get(int key)
IntObjectMapget in interface IntObjectMap<V>key - the key whose associated value is to be returned.null if the key was not found in the map.public V put(int key, V value)
IntObjectMapput in interface IntObjectMap<V>key - the key of the entry.value - the value of the entry.null if there was no previous mapping.public void putAll(IntObjectMap<V> sourceMap)
IntObjectMapputAll in interface IntObjectMap<V>public V remove(int key)
IntObjectMapremove in interface IntObjectMap<V>key - the key for the entry to be removed from this map.null if there was no mapping.public int size()
IntObjectMapsize in interface IntObjectMap<V>public boolean isEmpty()
IntObjectMapIntObjectMap.size() == {@code 0]).isEmpty in interface IntObjectMap<V>public void clear()
IntObjectMapclear in interface IntObjectMap<V>public boolean containsKey(int key)
IntObjectMapcontainsKey in interface IntObjectMap<V>public boolean containsValue(V value)
IntObjectMapcontainsValue in interface IntObjectMap<V>public java.lang.Iterable<IntObjectMap.Entry<V>> entries()
IntObjectMapentries in interface IntObjectMap<V>public java.util.Iterator<IntObjectMap.Entry<V>> iterator()
iterator in interface java.lang.Iterable<IntObjectMap.Entry<V>>public int[] keys()
IntObjectMapkeys in interface IntObjectMap<V>public V[] values(java.lang.Class<V> clazz)
IntObjectMapvalues in interface IntObjectMap<V>public java.util.Collection<V> values()
IntObjectMapCollection.values in interface IntObjectMap<V>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.String keyToString(int key)
toString() in order to convert a single map key into a string.Copyright © 2008–2018 The Netty Project. All rights reserved.