IdentityHashMap (Java SE 26 & JDK 26)
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values
- All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>
-
Nested Class Summary
-
Constructor Summary
Constructors
Constructs a new, empty identity hash map with a default expected maximum size (21).
IdentityHashMap(int expectedMaxSize) Constructs a new, empty map with the specified expected maximum size.
IdentityHashMap(Map<? extends K, ? extends V> m) Constructs a new identity hash map containing the key-value mappings in the specified map.
-
Method Summary
voidclear()Removes all of the mappings from this map.
clone()Returns a shallow copy of this identity hash map: the keys and values themselves are not cloned.
booleanTests whether the specified object reference is a key in this identity hash map.
booleanTests whether the specified object reference is a value in this identity hash map.
entrySet()Returns a
Setview of the mappings contained in this map.booleanCompares the specified object with this map for equality.
Returns the value to which the specified key is mapped, or
nullif this map contains no mapping for the key.inthashCode()Returns the hash code value for this map.
booleanisEmpty()Returns
trueif this identity hash map contains no key-value mappings.keySet()Returns an identity-based set view of the keys contained in this map.
Associates the specified value with the specified key in this identity hash map.
voidputAll(Map<? extends K, ? extends V> m) Copies all of the mappings from the specified map to this map.
Removes the mapping for this key from this map if present.
booleanRemoves the entry for the specified key only if it is currently mapped to the specified value (optional operation).
booleanreplace(K key, V oldValue, V newValue) Replaces the entry for the specified key only if currently mapped to the specified value (optional operation).
intsize()Returns the number of key-value mappings in this identity hash map.
values()Returns a
Collectionview of the values contained in this map.Methods declared in class Object
finalize, getClass, notify, notifyAll, wait, wait, waitprotected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
Methods declared in interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, replace, replaceAlldefault Vcompute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Attempts to compute a mapping for the specified key and its current mapped value, or
nullif there is no current mapping (optional operation).default VIf the specified key is not already associated with a value (or is mapped to
null), attempts to compute its value using the given mapping function and enters it into this map unlessnull(optional operation).default VIf the value for the specified key is present and non-null, attempts to compute a new mapping given the key and its current mapped value (optional operation).
default voidPerforms the given action for each entry in this map until all entries have been processed or the action throws an exception.
default VReturns the value to which the specified key is mapped, or
defaultValueif this map contains no mapping for the key.default Vmerge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) If the specified key is not already associated with a value or is associated with null, associates it with the given non-null value (optional operation).
default VIf the specified key is not already associated with a value (or is mapped to
null) associates it with the given value and returnsnull, else returns the current value (optional operation).default VReplaces the entry for the specified key only if it is currently mapped to some value (optional operation).
default voidReplaces each entry's value with the result of invoking the given function on that entry until all entries have been processed or the function throws an exception (optional operation).
-
Constructor Details
-
IdentityHashMap
-
IdentityHashMap
-
IdentityHashMap
-
-
Method Details
-
size
-
isEmpty
-
get
-
containsKey
-
containsValue
-
put
-
putAll
-
remove
-
clear
-
equals
-
hashCode
-
clone
-
keySet
-
values
-
entrySet
-
remove
-
replace
-