Streams returned by flat-mappers (parallel, unordered)
Brian Goetz
brian.goetz at oracle.com
Fri Apr 12 10:29:16 PDT 2013
The implementation, currently, will iterate the stream sequentially.
But, I don't think there are any restrictions on parallelism or
ordering; the implementation is going to iterate what is returned and
send it downstream. I think users are best off doing the minimum
necessary to construct a stream, and let the library take it from there.
So my inclination is to not burden the users with additional
requirements here.
On 4/12/2013 1:08 PM, Georgiy Rakov wrote:
> Hello,
>
> according to b85 all the flatMap-methods accept mappers returning stream
> instances (Function<T, Stream <R>>, IntFunction<IntStream>, etc.).
>
> I wonder if spec will specify any recommendations regarding what kinds
> of streams user should or should not return from flat-mappers.
> For instance:
>
> "If called stream is supposed to be executed in parallel then
> flat-mapper should return parallel streams or streams which could be
> converted to those by calling its parallel() method; otherwise the
> streams returned by flat-mapper will be executed sequentially."
>
> Recommendations regarding unordered streams also seem to be interesting.
>
> Thanks,
> Georgiy.
>
More information about the lambda-dev
mailing list