Constructing parallel streams

Remi Forax forax at univ-mlv.fr
Mon Dec 10 23:47:26 PST 2012


On 12/11/2012 02:20 AM, Brian Goetz wrote:
>> And what is the semantics of parallel on an infinite stream, you split
>> the infinity ?
>
> It is perfectly sensible.  We can take infinite generators and 
> parallelize them easily enough; see the implementation of 
> Iterators.spliterator().  The only challenge is "how do you make it 
> stop", if you care about that.  Which is why we're talking about 
> cancelation.

You are saying that you have a way to limit the stream, why is it 
different from parallelStream.limit(...).into(new ArrayList<>).stream() 
with limit using the semantics suggested by Sam.

Rémi




More information about the lambda-libs-spec-observers mailing list