Mega Code Archive

 
Categories / Java Tutorial / Collections
 

To get rid of all key-value pairs

public  void clear() import java.util.Hashtable; public class MainClass {   public static void main(String[] s) {     Hashtable table = new Hashtable();     table.put("key1", "value1");     table.put("key2", "value2");     table.put("key3", "value3");     table.clear();     System.out.println(table);   } } {}