The java.util.HashMap.containsValue() method is used to check whether a particular value is being mapped by a single or more than one key in the HashMap. It takes the Value as a parameter and returns True if that value is mapped by any of the key in the map.
Parameters: The method takes just one parameter Value of Object type and refers to the value whose mapping is supposed to be checked by any key inside the map.
Return Value: The method returns boolean true if the mapping of the value is detected else false.
Below programs are used to illustrate the working of java.util.HashMap.containsValue() Method: Program 1: Mapping String Values to Integer Keys.
// Java code to illustrate the containsValue() method
Please Login to comment...