![]() |
VOOZH | about |
The java.util.Hashtable.containsValue() method is used to check whether a particular value is being mapped by a single or more than one key in the Hashtable. It takes the Value as a parameter and returns True if that value is mapped by any of the keys in the table.
Syntax:
Hash_Table.containsValue(Object Value)
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 table.
Return Value: The method returns boolean true if the value is mapped to any key in the Hashtable otherwise it returns false.
Below programs are used to illustrate the working of java.util.Hashtable.containsValue() Method:
Program 1:
Initial Table is: {10=Geeks, 20=Geeks, 30=You, 15=4, 25=Welcomes}
Is the value 'Geeks' present? true
Is the value 'World' present? falseProgram 2:
Initial Table is: {You=30, Welcomes=25, 4=15, Geeks=20}
Is the value '10' present? false
Is the value '30' present? true
Is the value '40' present? falseNote: The same operation can be performed with any type of variation and combination of different data types.