Java HashSet Key Exists Example
Chapter:
Collections
Last Updated:
15-05-2016 16:06:52 UTC
Program:
/* ............... START ............... */
import java.util.Hashtable;
public class JavaHashTableKeyExists {
public static void main(String[] args) {
// create Hashtable object
Hashtable hashTable = new Hashtable();
// add key value pairs to Hashtable
hashTable.put("1", "One");
hashTable.put("2", "Two");
hashTable.put("3", "Three");
boolean exists = hashTable.containsKey("2");
System.out.println("Result : " + exists);
}
}
/* ............... END ............... */
Output
Tags
Collection, HashSet Key Exists, Java