In this tutorial, you will learn about the methods of HashMap class in Java, and tutorials for each of them.
Java HashMap
The following tutorials cover methods of the HashMap class.
- Java HashMap – clear() Removes all the mappings from HashMap.
- Java HashMap – clone() Makes a shallow copy of the HashMap.
- Java HashMap – compute() Computes a mapping for the given key in HashMap.
- Java HashMap – computeIfAbsent() Computes a mapping for the given key in HashMap, if the given key is absent in the HashMap.
- Java HashMap – computeIfPresent() Computes a mapping for the given key in HashMap, if the given key is present in the HashMap.
- Java HashMap – containsKey() Check if given key is present in the HashMap.
- Java HashMap – containsValue() Check if given value is present in the HashMap.
- Java HashMap – entrySet() Get key-value pairs of the HashMap as an EntrySet.
- Java HashMap – get() Get the value corresponding to a given key in the HashMap.
- Java HashMap – isEmpty() Check if the HashMap is empty.
- Java HashMap – keySet() Get all the keys in HashMap.
- Java HashMap – merge() Merge the given key-value in the HashMap.
- Java HashMap – put() Insert given key-value into HashMap.
- Java HashMap – putAll() Insert all the key-value pairs of a given mapping into this HashMap.
- Java HashMap – remove() Remove key-value pair from the HashMap based on given key.
- Java HashMap – size() Get the size of the HashMap.
- Java HashMap – values() Get all the values of the HashMap.