TreeMap containsValue() method in java
map Integer values to String keys
import java.util.TreeMap;
public class TreeMapContainsValueMethodExample
{
   public static void main(String[] args)
   {
      TreeMap<String, Integer> tm = new TreeMap<String, Integer>();
      // Map integer values to string keys
      tm.put("indigo", 16);
      tm.put("red", 12);
      tm.put("indigo", 14);
      tm.put("orange", 18);
      tm.put("violet", 20);
      System.out.println("TreeMap before using containsValue() method: " + tm);
      // Checking for the Value '12'
      System.out.println("Does value '12' present? " + tm.containsValue(12));
      // Checking for the Value '14'
      System.out.println("Does value '14' present? " + tm.containsValue(14));
      // Checking for the Value '20'
      System.out.println("Does value '20' present? " + tm.containsValue(20));
   }
}
