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>| 构造器和说明 |
|---|
IntObjectHashMap() |
IntObjectHashMap(int initialCapacity) |
IntObjectHashMap(int initialCapacity,
float loadFactor) |
| 限定符和类型 | 方法和说明 |
|---|---|
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 在接口中 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 在接口中 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 在接口中 IntObjectMap<V>public V remove(int key)
IntObjectMapremove 在接口中 IntObjectMap<V>key - the key for the entry to be removed from this map.null if there was no mapping.public int size()
IntObjectMapsize 在接口中 IntObjectMap<V>public boolean isEmpty()
IntObjectMapIntObjectMap.size() == {@code 0]).isEmpty 在接口中 IntObjectMap<V>public void clear()
IntObjectMapclear 在接口中 IntObjectMap<V>public boolean containsKey(int key)
IntObjectMapcontainsKey 在接口中 IntObjectMap<V>public boolean containsValue(V value)
IntObjectMapcontainsValue 在接口中 IntObjectMap<V>public java.lang.Iterable<IntObjectMap.Entry<V>> entries()
IntObjectMapentries 在接口中 IntObjectMap<V>public java.util.Iterator<IntObjectMap.Entry<V>> iterator()
iterator 在接口中 java.lang.Iterable<IntObjectMap.Entry<V>>public int[] keys()
IntObjectMapkeys 在接口中 IntObjectMap<V>public V[] values(java.lang.Class<V> clazz)
IntObjectMapvalues 在接口中 IntObjectMap<V>public java.util.Collection<V> values()
IntObjectMapCollection.values 在接口中 IntObjectMap<V>public int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Objectpublic java.lang.String toString()
toString 在类中 java.lang.Objectprotected java.lang.String keyToString(int key)
toString() in order to convert a single map key into a string.