Operations on HashMap

Checking if a key is present in the HashMap

We can use the containsKey(Object key) method to check if a given key is present in the HashMap. This method returns true if the key is present and returns false if the key is not present. Similarly, we have a containsValue(Object value) method that returns true if one or more keys are mapped to this value.

Get hands-on with 1400+ tech skills courses.