how to iterate hashmap java

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

Also in Java: