flatMap still prevents short circuiting when using .iterator()

Stephen Buergler sixcorners at gmail.com
Tue Aug 20 08:55:26 UTC 2019

Oops thanks.
So I think the issue is that StreamSpliterators.java has this line
bufferSink = ph.wrapSink(b::accept);
that creates a Sink that never returns true in cancellationRequested()
which is needed to get flatMap() to stop looping.

On Thu, Aug 15, 2019 at 7:43 PM David Holmes <david.holmes at oracle.com> wrote:
> Re-directing to core-libs-dev
> David
> On 15/08/2019 7:48 pm, Stephen Buergler wrote:
> > Not really sure where to send this.
> > flatMap was fixed so that it doesn't prevent short circuiting.
> > https://bugs.openjdk.java.net/browse/JDK-8075939
> > If you replace the test cases in the ticket with versions that use
> > .iterator().next() instead of .findFirst().get() then the problem
> > still happens.
> > I just tested this with openjdk:14 on docker hub.
> >

More information about the core-libs-dev mailing list