Examples for java stream api

This commit is contained in:
NKaushik89
2018-11-29 22:46:51 +05:30
parent 3763010afc
commit 6d89df562e
5 changed files with 219 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import java.util.ArrayList;
import java.util.List;
public class ExampleParallelStream {
public static void main(String[] args) {
List<Integer> intList = new ArrayList<>();
intList.add(1);
intList.add(2);
intList.add(3);
intList.add(4);
intList.add(5);
intList.parallelStream().
filter(e -> {
System.out.println("filter " + e);
return true;
}).
forEach(e -> System.out.println("ForEach " + e));
}
}