3 ms·
> However, even in the Java side, the example could be done with reduce alone, I think. That’s my point: teeing itself is not aggregate/reduce. If after the br
by kaba0 6y ago
> However, even in the Java side, the example could be done with reduce alone, I think.
That’s my point: teeing itself is not aggregate/reduce. If after the branching the streams differ in size, reduce no longer applies, for example.
- jayd16 6y agoBut my point is that Aggregate and reduce can handle that in this case because they both can simply add to the PriceAndRows instance incrementally. You can sum the total and build the list in the body of the Aggregate/reduce method. Teeing is pointless here. There's no need to use another collector.