1for (Map.Entry<String, String> entry : yourHashMap.entrySet()) {
2 System.out.println(entry.getKey() + " = " + entry.getValue());
3}
1Map<Integer, Integer> map = new HashMap<Integer, Integer>();
2for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
3 System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
4}