Java HashTable Size Example
Chapter:
Collections
Last Updated:
15-05-2016 16:13:51 UTC
Program:
/* ............... START ............... */
import java.util.Hashtable;
public class JavaHashTableSize {
public static void main(String[] args) {
Hashtable hashTable = new Hashtable();
System.out.println("Size of Hashtable : " + hashTable.size());
hashTable.put("1", "One");
hashTable.put("2", "Two");
hashTable.put("3", "Three");
System.out.println("Size of Hashtable after addition : " + hashTable.size());
Object object = hashTable.remove("2");
System.out.println("Size of Hashtable after removal : " + hashTable.size());
}
}
/* ............... END ............... */
Output
Size of Hashtable : 0
Size of Hashtable after addition : 3
Size of Hashtable after removal : 2
Tags
Collection, HashTable Size, Java