How to get all keys/values out of a Hashtable.
If you like to program in Java language, it is good to know there are a number of ways to get all keys/values out of a Hashtable. Hashtable ht = new Hashtable(); ht.put(“one”,new Integer(1)); ht.put(“two”,new Integer(2)); Enumeration en = ht.elements(); while(en.hasMoreElements()){ System.out.println((Integer)en.nextElement()); } or Hashtable ht = new Hashtable(); ht.put(“one”,new Integer(1)); ht.put(“two”,new Integer(2)); Iterator it=hr.keySet().Iterator(); [...]
No Comments »
Filed under: Java
