public class HashMapExample {
public static void main(String[] args) {
HashMap hm = new HashMap<Object,String>();
hm.put(new Integer(2),"two");
hm.put(new Integer(3),"threee");
hm.put(new Integer(1),"one");
hm.put(new Integer(4),"four");
Set s = hm.entrySet();
Iterator it =s.iterator();
while(it.hasNext()) {
Map.Entry m = (Map.Entry)it.next();
int key = (Integer)m.getKey();
String value = (String)m.getValue();
System.out.println("key: " + key);
System.out.println("value:" + value);
}
}
}