Entry-set is iterated as :
public static void printMaps(Map map) {
Iterator itr = map.entrySet().iterator();
while (itr.hasNext()) {
Map.Entry pairs = (Map.Entry)itr.next();
System.out.println(pairs.getKey() + " = " + pairs.getValue());
itr.remove(); // ConcurrentModificationException is avoided
}
}