Skip to content

Commit 5a66215

Browse files
committed
added lambda foreach method example
1 parent 733127e commit 5a66215

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package java8.functionalInterface;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class ForEachDemo2
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->System.out.println(item));
19+
20+
}
21+
}

0 commit comments

Comments
 (0)