V - The value type stored in the map.public class IntObjectHashMap<V> extends Object implements IntObjectMap<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.PrimitiveEntry<V>| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_CAPACITY
Default initial capacity.
|
static float |
DEFAULT_LOAD_FACTOR
Default load factor.
|
| 构造器和说明 |
|---|
IntObjectHashMap() |
IntObjectHashMap(int initialCapacity) |
IntObjectHashMap(int initialCapacity,
float loadFactor) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear() |
boolean |
containsKey(int key)
Indicates whether or not this map contains a value for the specified key.
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Iterable<IntObjectMap.PrimitiveEntry<V>> |
entries()
Gets an iterable to traverse over the primitive entries contained in this map.
|
Set<Map.Entry<Integer,V>> |
entrySet() |
boolean |
equals(Object obj) |
V |
get(int key)
Gets the value in the map with the specified key.
|
V |
get(Object key) |
int |
hashCode() |
boolean |
isEmpty() |
Set<Integer> |
keySet() |
protected String |
keyToString(int key)
Helper method called by
toString() in order to convert a single map key into a string. |
V |
put(Integer key,
V value) |
V |
put(int key,
V value)
Puts the given entry into the map.
|
void |
putAll(Map<? extends Integer,? extends V> sourceMap) |
V |
remove(int key)
Removes the entry with the specified key.
|
V |
remove(Object key) |
int |
size() |
String |
toString() |
Collection<V> |
values() |
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic static final int DEFAULT_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
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 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 boolean containsKey(int key)
IntObjectMapcontainsKey 在接口中 IntObjectMap<V>key - keypublic boolean containsValue(Object value)
containsValue 在接口中 Map<Integer,V>public Iterable<IntObjectMap.PrimitiveEntry<V>> entries()
IntObjectMapIntObjectMap.PrimitiveEntrys returned by the Iterator may change as the Iterator
progresses. The caller should not rely on IntObjectMap.PrimitiveEntry key/value stability.entries 在接口中 IntObjectMap<V>public boolean containsKey(Object key)
containsKey 在接口中 Map<Integer,V>protected String keyToString(int 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.key - keyCopyright © 2022. All rights reserved.