Modifier and Type Method and Description
void [**clear**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#clear-->)()Removes all of the mappings from this map.
Object [**clone**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#clone-->)()Returns a shallow copy of this HashMap instance: the keys and values themselves are not cloned.
V [**compute**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#compute-K-java.util.function.BiFunction->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**BiFunction**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/BiFunction.html>)<? super [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> remappingFunction)Attempts to compute a mapping for the specified key and its current mapped value (or null if there is no current mapping).
V [**computeIfAbsent**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#computeIfAbsent-K-java.util.function.Function->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**Function**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html>)<? super [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> mappingFunction)If 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 unless null.
V [**computeIfPresent**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#computeIfPresent-K-java.util.function.BiFunction->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**BiFunction**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/BiFunction.html>)<? super [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> remappingFunction)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.
boolean [**containsKey**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#containsKey-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) key)Returns true if this map contains a mapping for the specified key.
boolean [**containsValue**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#containsValue-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) value)Returns true if this map maps one or more keys to the specified value.
[**Set**](<https://docs.oracle.com/javase/8/docs/api/java/util/Set.html>)<[**Map.Entry**](<https://docs.oracle.com/javase/8/docs/api/java/util/Map.Entry.html>)<[**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),[**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)>> [**entrySet**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#entrySet-->)()Returns a Set view of the mappings contained in this map.
void [**forEach**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#forEach-java.util.function.BiConsumer->)([**BiConsumer**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/BiConsumer.html>)<? super [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> action)Performs the given action for each entry in this map until all entries have been processed or the action throws an exception.
V [**get**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#get-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) key)Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
V [**getOrDefault**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#getOrDefault-java.lang.Object-V->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) defaultValue)Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
boolean [**isEmpty**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#isEmpty-->)()Returns true if this map contains no key-value mappings.
[**Set**](<https://docs.oracle.com/javase/8/docs/api/java/util/Set.html>)<[**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> [**keySet**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#keySet-->)()Returns a Set view of the keys contained in this map.
V [**merge**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#merge-K-V-java.util.function.BiFunction->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) value, [**BiFunction**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/BiFunction.html>)<? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> 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.
V [**put**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#put-K-V->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) value)Associates the specified value with the specified key in this map.
void [**putAll**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#putAll-java.util.Map->)([**Map**](<https://docs.oracle.com/javase/8/docs/api/java/util/Map.html>)<? extends [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> m)Copies all of the mappings from the specified map to this map.
V [**putIfAbsent**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#putIfAbsent-K-V->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) value)If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.
V [**remove**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#remove-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) key)Removes the mapping for the specified key from this map if present.
boolean [**remove**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#remove-java.lang.Object-java.lang.Object->)([**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) key, [**Object**](<https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html>) value)Removes the entry for the specified key only if it is currently mapped to the specified value.
V [**replace**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#replace-K-V->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) value)Replaces the entry for the specified key only if it is currently mapped to some value.
boolean [**replace**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#replace-K-V-V->)([**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) key, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) oldValue, [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>) newValue)Replaces the entry for the specified key only if currently mapped to the specified value.
void [**replaceAll**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#replaceAll-java.util.function.BiFunction->)([**BiFunction**](<https://docs.oracle.com/javase/8/docs/api/java/util/function/BiFunction.html>)<? super [**K**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? super [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>),? extends [**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> function)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.
int [**size**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#size-->)()Returns the number of key-value mappings in this map.
[**Collection**](<https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html>)<[**V**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html>)> [**values**](<https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.html#values-->)()Returns a Collection view of the values contained in this map.