Check if a particular value exists in TreeMap - Java Collection Framework

Java examples for Collection Framework:TreeMap

Description

Check if a particular value exists in TreeMap

Demo Code

 
import java.util.TreeMap;
 
public class Main {
 
  public static void main(String[] args) {
    TreeMap treeMap = new TreeMap();
   /*from  w  w w .j a  va  2 s . c o  m*/
    treeMap.put("1","One");
    treeMap.put("2","Two");
    treeMap.put("3","Three");
   
    boolean blnExists = treeMap.containsValue("Three");
    System.out.println("Three exists in TreeMap ? : " + blnExists);
  }
}

Result


Related Tutorials