Performs the given action for each entry.
Syntax
map.forEach((k, v) -> { ... })Example
Enter values below to update the example in real time.
Map→String→map→new→HashMap→put→forEach→System→out→println→Map<String, Integer> map = new HashMap<>();
map.put("a", 1);
map.put("b", 2);
map.forEach((k, v) -> System.out.println(k + "=" + v));