iterate over entryset in stream java code example
Example 1: java 8 map foreach
public void iterateUsingLambda(Map<String, Integer> map) {
map.forEach((k, v) -> System.out.println((k + ":" + v)));
}
Example 2: iterate map in java 8 using stream
public void iterateUsingStreamAPI(Map<String, Integer> map) {
map.entrySet().stream()
// ...
.forEach(e -> System.out.println(e.getKey() + ":" + e.getValue()));
}