java.util.HashMap
Hash table-based implementation of the Map interface.
Some methods of HashMap class.
clear(): This method removes all of the mappings from this map.
clone(): This method returns a shallow copy of this HashMap instance: 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 mappingfunction and enter it into this map unless null.
computeIfPresent(K, BiFunction): f 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 returns true if this map contains a mapping for the specified key.
containsValue(Object): This method returns true if this map maps one or more keys to the specified value.
entrySet(): This method returns a Set view of the mappings contained in this 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 map contains no key-value mappings.
keySet(): This method returns a 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 map.
putAll(Map): This method copies all of the mappings from the specified map to this map.
putIfAbsent(K, V): If the specified key is not already associated with a value associates it with the given value and returns null, else returns the current value.
remove(Object): This method removes the mapping for the specified 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.
replace(K, V, V): This method replaces the entry for the specified key only if currently mapped to the specified 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 map.
values(): This method returns a Collection view of the values contained in this map.
No comments:
Post a Comment