I have a Hashtable in Java and want to iterate over all the values in the table and delete a particular key-value pair while iterating.
How may this be done?
You can use Enumeration:
Enumeration
Hashtable table = ... Enumeration enumKey = table.keys(); while(enumKey.hasMoreElements()) { Integer key = enumKey.nextElement(); String val = table.get(key); if(key==0 && val.equals("0")) table.remove(key); }