We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5a66215 commit e0a928dCopy full SHA for e0a928d
java8Tutorials/src/main/java/java8/functionalInterface/ForEachDemo3.java
@@ -0,0 +1,25 @@
1
+package java8.functionalInterface;
2
+
3
+import java.util.ArrayList;
4
+import java.util.List;
5
6
+public class ForEachDemo3
7
+{
8
+ public static void main(String[] args)
9
+ {
10
+ List<Integer> intItems = new ArrayList<>();
11
+ intItems.add(10);
12
+ intItems.add(50);
13
+ intItems.add(40);
14
+ intItems.add(30);
15
+ intItems.add(20);
16
17
+ //lambda
18
+ intItems.forEach(item->{
19
+ if(item>20)
20
21
+ System.out.println(item);//50 40 30
22
+ }
23
+ });
24
25
+}
0 commit comments