这是一个创建于 1204 天前的主题,其中的信息可能已经有所发展或是发生改变。
Performs a reduction on the elements of this stream, using the provided identity, accumulation and combining functions. This is equivalent to:
U result = identity;
for (T element : this stream)
result = accumulator.apply(result, element)
return result;
but is not constrained to execute sequentially.
The identity value must be an identity for the combiner function. This means that for all u, combiner(identity, u) is equal to u.
搜了下大概知道这个 combiner 是并行流合并子流 reduce 的结果用的,但是那个 combiner(identity, u) is equal to u.是啥意思
2 条回复 • 2021-08-09 12:17:10 +08:00
|
|
1
sosilver 2021-08-09 12:11:12 +08:00 via Android
wiki/Identity_element
|
|
|
2
Leviathann 2021-08-09 12:17:10 +08:00 via iPhone
@ sosilver 原来如此,吃了数学的亏 我一直以为物理数学里的 单位 都是 unit 。。
|