Regex Point Lambdafication Patch

Remi Forax forax at univ-mlv.fr
Sun Mar 10 12:26:32 PDT 2013


On 03/10/2013 07:26 PM, Brian Goetz wrote:
> Because you're not overriding trySplit, this spliterator will not allow
> streams to be parallelized at all, even if the downstream operations
> could benefit from such, such as in:
>
>     pattern.splitAsStream(bigString)
>            .parallel()
>            .map(expensiveTransform)
>            .forEach(...);
>
> Even though the above pipeline will be limited by the sequential regex
> splitting at its source, if the downstream operations are expensive
> enough, they could still benefit from parallelization.  But the
> spliterator, as written, won't permit that -- it is strictly sequential.

I wonder if in that case, when the transformation is more expensive that 
the pattern matching, it not better to wrap the result of 
pattern.split() in a stream with Array.stream().

Rémi



More information about the lambda-dev mailing list