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:

 

原文地址:https://www.cnblogs.com/xp2h/p/12520202.html