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

Java examples for Collection Framework:Hashtable

Description

Check if a particular value exists in Hashtable

Demo Code

 
import java.util.Hashtable;
 
public class Main {
 
  public static void main(String[] args) {
    Hashtable ht = new Hashtable();
    ht.put("1","One");
    ht.put("2","Two");
    ht.put("3","Three");
   // ww w. jav  a2 s.  co  m
    boolean blnExists = ht.contains("Two");
    System.out.println("Two exists in Hashtable ? : " + blnExists);
  }
}
 

Result


Related Tutorials