Class Pipeline.CollectionPipeline<T,R>
java.lang.Object
cloud.opencode.base.functional.pipeline.Pipeline.CollectionPipeline<T,R>
- Type Parameters:
T- input element type - 输入元素类型R- output element type - 输出元素类型
CollectionPipeline - Pipeline for processing collections
CollectionPipeline - 用于处理集合的管道
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if all elements match 检查是否所有元素都匹配booleanCheck if any element matches 检查是否有任何元素匹配longcount()Execute and count results 执行并计数结果Filter elements 过滤元素Find first matching element 查找第一个匹配元素voidExecute and perform action on each 执行并对每个元素执行动作<U> Pipeline.CollectionPipeline<T, U> Transform each element 转换每个元素reduce(R identity, BinaryOperator<R> accumulator) Reduce elements to single value 将元素规约为单个值toList()Execute and collect to List 执行并收集为 List
-
Method Details
-
map
Transform each element 转换每个元素- Type Parameters:
U- result type - 结果类型- Parameters:
mapper- transformation function - 转换函数- Returns:
- pipeline with transformation
-
filter
Filter elements 过滤元素- Parameters:
predicate- filter condition - 过滤条件- Returns:
- filtered pipeline
-
toList
-
forEach
-
count
public long count()Execute and count results 执行并计数结果- Returns:
- count of elements
-
findFirst
-
anyMatch
-
allMatch
-
reduce
Reduce elements to single value 将元素规约为单个值- Parameters:
identity- identity value - 恒等值accumulator- accumulator function - 累加器函数- Returns:
- reduced value
-