Constructing parallel streams

Howard Lovatt howard.lovatt at gmail.com
Wed Dec 12 20:28:50 PST 2012


In my library I had no problem with infinite parallel streams. I have a method Break() that throws a pre-made breakException. Any Mapper, Filter, Reducer, etc. can call Break and terminate the processing and cause current and all subsequent elements even if processed on a different thread to be discarded. 

 -- Howard Lovatt +61 419 971 263 (sent from my PDA)

PS I also have Continue() which has also proved useful. 

On 11/12/2012, at 12:20 PM, Brian Goetz <brian.goetz at oracle.com> 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.
> 


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