Skip to content

Commit 25fa3a4

Browse files
authored
Add files via upload
1 parent e02450e commit 25fa3a4

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
*
3+
*/
4+
package examples;
5+
6+
import java.util.HashMap;
7+
import java.util.Map;
8+
9+
/**
10+
* @author rutpatel
11+
*
12+
*/
13+
public class forEachMethod {
14+
15+
/**
16+
* @param args
17+
*/
18+
public static void main(String[] args) {
19+
20+
Map<String, Integer> items = new HashMap<>();
21+
items.put("A", 10);
22+
items.put("B", 20);
23+
items.put("C", 30);
24+
items.put("D", 40);
25+
items.put("E", 50);
26+
items.put("F", 60);
27+
28+
items.forEach((k, v) -> System.out.println("Item : " + k + " Count : " + v));
29+
30+
items.forEach((k, v) -> {
31+
if ("E".equals(k)) {
32+
System.out.println("Hello E");
33+
}
34+
});
35+
36+
}
37+
38+
}

0 commit comments

Comments
 (0)