java.util.IdentityHashMap
This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).
Some methods of IdentityHashMap class.
clear(): This method removes all of the mappings from this map.
clone(): This method returns a shallow copy of this identity hash map: the keys and values themselves are not cloned.
compute(K, BiFunction): This method attempts to compute a mapping for the specified key and its current mapped value.
computeIfAbsent(K, Function): If the specified key is not already associated with a value attempt to compute its value using the given mapping function and enter it into this map unless null.
computeIfPresent(K, BiFunction): If 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.
containsKey(Object): This method tests whether the specified object reference is a key in this identity hashmap.
containsValue(Object): This method tests whether the specified object reference is a value in this identity hashmap.
entrySet(): This method returns a Set view of the mappings contained in this map. Each element in the returned set is a reference-equality-based Map
equals(Object): This method compares the specified object with this map for equality.
forEach(BiConsumer): This method performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
get(Object): This method returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
getOrDefault(Object, V): This method returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
hashCode(): This method returns the hash code value for this map.
isEmpty(): This method returns true if this identity hash map contains no key-value mappings.
keySet(): This method returns an identity-based set view of the keys contained in this map.
merge(K, V, BiFunction): If the specified key is not already associated with a value or is associated with null, associate it with the given non-null value.
put(K, V): This method associates the specified value with the specified key in this identity hashmap.
putAll(Map): This method copies all of the mappings from the specified map to this map.
remove(Object): This method removes the mapping for this key from this map if present.
remove(Object, Object): This method removes the entry for the specified key only if it is currently mapped to the specified value.
replace(K, V): This method replaces the entry for the specified key only if it is currently mapped to some value.
replaceAll(BiFunction): This method replaces 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.
size(): This method returns the number of key-value mappings in this identity hash map.
toString(): This method returns a string representation of this map.
values(): This method returns a Collection view of the values contained in this map.
No comments:
Post a Comment