1.map
List<Integer> list = Arrays.asList(1,2,3,4);
List<Integer> list1 = list.stream().map(n -> n*n).collect(Collectors.toList());
最后结果为:1,4,9,16
2.filter
List<Integer> list = Arrays.asList(1,2,3,4);
long count = list.stream().filter(n -> n>2).count();
最后结果为:2
3.parallelStream()
并行
4.foreach