RFR 8027316 Distinct operation on an unordered stream should not be a barrier

Paul Sandoz paul.sandoz at oracle.com
Fri Nov 1 16:34:58 UTC 2013


On Oct 30, 2013, at 5:54 PM, Henry Jen <henry.jen at oracle.com> wrote:

> Looks good to me.
> 
> In the test, 
> 
>> Integer one = Stream.iterate(1, i -> i + 1).unordered().parallel().distinct().findAny().get();
>> assertEquals(one.intValue(), 1);
> 
> The implementation is probably make sure this will return 1, but is that what we spec to do? I sort of think it can have various values depends on how many working threads and their scheduling.
> 

Doh! you are correct, sorry, i made a silly mistake and had this in my head "Stream.iterate(1, i -> i + 1).parallel().distinct().findFirst().get()" when i responded. This test is failing in some cases exactly for the reasons you give.

Paul.


More information about the core-libs-dev mailing list