How to Check if value exists in HashMap

To check if Value exists in HashMap, we use the containsValue(Object key) method provided by HashMap.

boolean containsValue(Object key) searches the HashMap for the given value and returns true if one or more keys to the specified value are found.

Lets see some examples on containsValue(Object key) method

Example : Check if Value exists in HashMap

Output

Reference

1. HashMap containsValue()

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn