void () { Map<String, Integer> m = new HashMap<String, Integer>(); m.put("123", 123); m.put("456", 456); <warning descr="'for' loop can be replaced with enhanced 'for'">for</warning>(Iterator<Map.Entry<String, Integer>> iterator = m.entrySet() .iterator(); iterator.hasNext();){ Map.Entry<String, Integer> entry = iterator.next(); System.out.println(entry.getKey() + "=" + entry.getValue()); } }