-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Use the Streams API to do a folding operation is hampered by the burden of the current reduce(), collect(), et al having to support parallel streams via the Collector combiner() method. Versions of Collector that don't have the combiner function requirement would make writing folding operations possible without relying on current JDK implementations only using the combiner for parallel streams.
The alternative is unpleasant. You must declare some kind of collector outside of the stream chain of calls which gets passed to forEachOrdered() and then, separately, is used to extract the final value. A quick search of SO will show developer's frustration at this missing functionality in Streams.
Use the Streams API to do a folding operation is hampered by the burden of the current reduce(), collect(), et al having to support parallel streams via the Collector combiner() method. Versions of Collector that don't have the combiner function requirement would make writing folding operations possible without relying on current JDK implementations only using the combiner for parallel streams.
The alternative is unpleasant. You must declare some kind of collector outside of the stream chain of calls which gets passed to forEachOrdered() and then, separately, is used to extract the final value. A quick search of SO will show developer's frustration at this missing functionality in Streams.
- relates to
-
JDK-8133680 add Stream.foldLeft() terminal operation
- Open