Check if a particular value exists in Java Hashtable
import java.util.Hashtable;
public class Main {
public static void main(String[] args) {
Hashtable<String, String> ht = new Hashtable<String, String>();
ht.put("1", "One");
ht.put("2", "Two");
ht.put("3", "Three");
boolean blnExists = ht.contains("Two");
System.out.println("Two exists in Hashtable ? : " + blnExists);
}
}
Related examples in the same category