目录
Stream可以是并行也可以是串行。
一、串行流和并行流的概念
1) 串行流 API:stream()
执行机制:基于pipeline(管道)
流的特性:
1. stream不存储数据
2. stream不改变数据源
3. stream不可重复使用
4. stream串行执行
5. 上个节点会影响下个节点
2) 并行流 API:parallelStream()
目录
Stream可以是并行也可以是串行。
1) 串行流 API:stream()
执行机制:基于pipeline(管道)
流的特性:
1. stream不存储数据
2. stream不改变数据源
3. stream不可重复使用
4. stream串行执行
5. 上个节点会影响下个节点
2) 并行流 API:parallelStream()