foreach over map code example
Example 1: java for map
Map<String, String> map = new HashMap<>();
for(Entry<String, String> entry:map.entrySet()) {
System.out.println("key: "+entry.getKey()+" value: "+entry.getValue());
}
Example 2: java foreach map
map.forEach((k, v) -> System.out.printf( " %s : %d \n" , k,v) );