import java.util.*; class Test { static public void main(String args[]) { HashMap h1=new HashMap(); HashMap h2=new HashMap(); h1.put(new Integer(1), new Integer(2)); h2.put(new Boolean(true), new Boolean(false)); for (Iterator i=h1.entrySet().iterator(); i.hasNext();) { Map.Entry entry=(Map.Entry)i.next(); Integer l=(Integer)entry.getKey(); } for (Iterator i=h2.entrySet().iterator(); i.hasNext();) { Map.Entry entry=(Map.Entry)i.next(); Boolean l=(Boolean)entry.getKey(); } } }