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)
IntObjectMap
get
在接口中 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)
IntObjectMap
put
在接口中 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)
IntObjectMap
putAll
在接口中 IntObjectMap<V>
public V remove(int key)
IntObjectMap
remove
在接口中 IntObjectMap<V>
key
- the key for the entry to be removed from this map.null
if there was no mapping.public int size()
IntObjectMap
size
在接口中 IntObjectMap<V>
public boolean isEmpty()
IntObjectMap
IntObjectMap.size()
== {@code 0]).isEmpty
在接口中 IntObjectMap<V>
public void clear()
IntObjectMap
clear
在接口中 IntObjectMap<V>
public boolean containsKey(int key)
IntObjectMap
containsKey
在接口中 IntObjectMap<V>
public boolean containsValue(V value)
IntObjectMap
containsValue
在接口中 IntObjectMap<V>
public java.lang.Iterable<IntObjectMap.Entry<V>> entries()
IntObjectMap
entries
在接口中 IntObjectMap<V>
public java.util.Iterator<IntObjectMap.Entry<V>> iterator()
iterator
在接口中 java.lang.Iterable<IntObjectMap.Entry<V>>
public int[] keys()
IntObjectMap
keys
在接口中 IntObjectMap<V>
public V[] values(java.lang.Class<V> clazz)
IntObjectMap
values
在接口中 IntObjectMap<V>
public java.util.Collection<V> values()
IntObjectMap
Collection
.values
在接口中 IntObjectMap<V>
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
protected java.lang.String keyToString(int key)
toString()
in order to convert a single map key into a string.