Popular Tutorials
Start Learning JavaCertification Courses
Created with over a decade of experience and thousands of feedback.
Java HashMap Methods
Java has a lot of HashMap methods that allow us to work with hashmaps. In this reference page, you will find all the hashmap methods available in Java. For example, if you need to add an element to the hashmap, use the put() method.
remove all elements from HashMap
makes the copy of the hashmap
checks if the HashMap is empty
returns the number of items in HashMap
inserts the specified item to the hashmap
inserts all items from a map to HashMap
inserts item if the key is not already present
removes the mapping for the specified key
checks if the specified key is present in HashMap
checks if HashMap contains the specified value
replaces the value for the specified key
replaces all values with
returns the value using the specified key
returns specified default value if key not found
performs the action to all entries of HashMap
returns a set view of all entries
returns a set view of all the keys of HashMap
returns a view of all values present in HashMap
merges the specified mapping to the HashMaps
computes a new value for the specified key
computes value if mapping for key is not present
computes a value for the mapping if key is present