热门
最新
红包
立Flag
投票
同城
我的
发布
《Streams under the hood》对 Stream 原理的介绍非常硬核,感兴趣可以看下。
https://developer.ibm.com/articles/j-java-streams-3-brian-goetz/
其中对无状态和有状态的讲解非常到位。
无状态指只和当前元素有关系,有状态则是指当前操作需要感知其他元素信息。
Intermediate operations are divided into stateless (filter(), map(), flatMap()) and stateful (sorted(), limit(), distinct()) operations. A stateless operation is one that can be performed on an element without knowledge of any of the other elements. For example, a filtering operation only needs to examine the current element to determine whether to include or eliminate it, but a sorting operation must see all the elements before it knows which element to emit first.
CSDN App 扫码分享
评论
2
打赏
- 复制链接
- 举报