Retrieve HashMap elements

We know that HashMap is a key-value pair based data structure. Sometimes, we need to retrieve all the keys of HashMap Sometimes we need to retrieve value for the specified key from the HashMap Sometimes we need to retrieve all the values from a HashMap Let’s see how we can achieve all these retrievals Case1: […]

Share this article on

Remove HashMap elements

We can remove elements from HashMap using methods provided in it There are 2 methods listed below which can be used to remove elements from HashMap Object remove(Object key) Removes the mapping for the specified key from this map if present. Void clear() Removes all of the mappings from this map Example import java.util.*; public […]

Share this article on
< Previous Next >