The java.util.TreeMap.containsValue() method is used to check whether a particular value is being mapped by any key in the TreeMap. It takes the Value as a parameter and returns True if that value is mapped by any of the keys 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.TreeMap.containsValue() Method:
Program 1: Mapping String Values to Integer Keys.
Program 2: Mapping Integer Values to String Keys.
Note: The same operation can be performed with any type of Mappings with variation and combination of different data types.
- Java.util.TreeMap.containskey() and containsValue() in Java
- Hashtable containsValue() Method in Java
- WeakHashMap containsValue() Method in Java
- HashMap containsValue() Method in Java
- Map containsValue() method in Java with Examples
- IdentityHashMap containsValue() Method in Java
- ConcurrentHashMap containsValue() Method in Java
- EnumMap containsValue(value) method in Java
- AbstractMap containsValue() Method in Java with Examples
- ConcurrentSkipListMap containsValue() method in Java with Examples
- Properties containsValue(value) method in Java with Examples
- TreeMap get() Method in Java
- TreeMap put() Method in Java
- TreeMap putAll() Method in Java
- TreeMap remove() Method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.