Java tutorial
import java.util.HashMap; import java.util.Iterator; import java.util.Set; public class Main { public static void main(String[] args) { HashMap<String, Integer> myMap = new HashMap<String, Integer>(); myMap.put("a", 1); myMap.put("b", 2); myMap.put("c", 3); Set<String> stStrKeys = myMap.keySet(); Iterator<String> itrs = stStrKeys.iterator(); while (itrs.hasNext()) { String s = itrs.next(); System.out.println(s + ": " + myMap.get(s)); } } }