Stream流

1、是什么

  JDK 1.8 用于解决已有集合、数组类库既有的弊端;简化集合和数组的操作;

2、常用API

#过滤
filter

#遍历
foreach

#统计
count

#截取
limit

#跳过
skip

#映射
map

#合并stream流
concat

3、收集流

  3.1 把stream转换为Set:

 

   3.2 把stream转换为List:

 

   3.3 把stream转换为Array:

 

 

posted @ 2020-03-18 21:03  门虫不是虫  阅读(99)  评论(0编辑  收藏  举报