First element of a parallel stream? +possible bug report

Dmitry Bessonov dmitry.bessonov at oracle.com
Tue Dec 4 13:43:58 PST 2012


On 05.12.2012 1:01, Paul Sandoz wrote:
> On Dec 4, 2012, at 3:05 PM, Dmitry Bessonov <dmitry.bessonov at oracle.com> wrote:
>
>> 1)Question:
>>
>> Is the result of the following chain of operations defined
>> and should be the same on all hardware/implementations?
>>
>> Arrays.asList("first", "second", "last").parallel().findFirst();
>>
> Yes, it will return the same result as for stream().findFirst().
>
>    
>> 2) Report: Slightly modified version throws NPE
>> (with the yesterday's state of the repo) :
>>
>> Arrays.asList("first", "second", null, "last").parallel().findFirst();
>>
> Right, Optional is totally null intolerant at the moment.


I know that it's about the parallel() implementation
but if the result is strictly defined - always the first element
then not tolerating the third 'null'
really looks like a bug no matter if Optional accepts nulls or not...


-Dmitry



More information about the lambda-dev mailing list