import java.util.HashMap;
public class MyClass {
public static void main(String[] args) {
HashMap<Integer, String> hmap = new HashMap<Integer, String>();
hmap.put(1, "Darth Vader");
hmap.put(5, "Luke Skywalker");
hmap.put(7, "Obi-Wan Kenobi");
hmap.put(2, "Han Solo");
for (Integer i : hmap.keySet()) {
System.out.println("key: " + i + " value: " + hmap.get(i));
}
}
}
/*
run:
key: 1 value: Darth Vader
key: 2 value: Han Solo
key: 5 value: Luke Skywalker
key: 7 value: Obi-Wan Kenobi
*/