RFR-8148838: Stream.flatMap(...).spliterator() cannot properly split after tryAdvance()

Tagir F. Valeev amaembo at gmail.com
Mon Feb 8 13:53:23 UTC 2016


Hello!

PS>  188         public Spliterator<P_OUT> trySplit() {
PS>  189             if (isParallel && !finished) {
PS>  190                 init();
PS>  191
PS>  192                 if (buffer != null && buffer.count() > 0) // partial traversal started
PS>  193                     return null;

PS> Why don’t you check if "buffer == null” at #189? i.e. similar to forEachRemaining:

That would make minimal behavioral change to fix this issue (fix
flatMap keys only, but not affect other intermediate ops which were
working correctly). Well, if buffer == null check is enough, here's
update:

http://cr.openjdk.java.net/~tvaleev/webrev/8148838/r4/
(test unchanged)

With best regards,
Tagir Valeev.




More information about the core-libs-dev mailing list