iterate map in java 8 using stream

95

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()));
}

Comments

Submit
0 Comments