Answers for "return in map java lambda foreacj"

1

foreach map java

Map<String, String> map = ...
for (Map.Entry<String, String> entry : map.entrySet()) {
    System.out.println(entry.getKey() + "/" + entry.getValue());
}
Posted by: Guest on June-01-2020
0

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()));
}
Posted by: Guest on March-10-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language