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
- EnumMap containsValue(value) method in Java
- ConcurrentHashMap containsValue() Method in Java
- IdentityHashMap containsValue() Method in Java
- HashMap containsValue() Method in Java
- WeakHashMap containsValue() Method in Java
- Map containsValue() method in Java with Examples
- Hashtable containsValue() Method in Java
- Properties containsValue(value) method in Java with Examples
- AbstractMap containsValue() Method in Java with Examples
- ConcurrentSkipListMap containsValue() method in Java with Examples
- TreeMap get() Method in Java
- TreeMap put() Method in Java
- TreeMap values() Method in Java
- TreeMap subMap() 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 firstname.lastname@example.org. 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.