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.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Java.util.TreeMap.containskey() and containsValue() in Java
- HashMap containsValue() Method in Java
- Hashtable containsValue() Method in Java
- EnumMap containsValue(value) method in Java
- WeakHashMap containsValue() Method in Java
- IdentityHashMap containsValue() Method in Java
- ConcurrentHashMap containsValue() Method in Java
- AbstractMap containsValue() Method in Java with Examples
- Map containsValue() method in Java with Examples
- ConcurrentSkipListMap containsValue() method in Java with Examples
- Properties containsValue(value) method in Java with Examples
- Java.util.TreeMap.descendingMap() and descendingKeyset() in Java
- Java.util.TreeMap.firstEntry() and firstKey() in Java
- Java.util.TreeMap.pollFirstEntry() and pollLastEntry() in Java
- Java.util.TreeMap.put() and putAll() in Java
- Java.util.TreeMap.floorEntry() and floorKey() in Java
- TreeMap size() Method in Java
- TreeMap get() Method in Java
- TreeMap clone() Method in Java
- TreeMap containsKey() 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.