[10] RFR 8075939: Stream.flatMap() causes breaking of short-circuiting of terminal operations
Remi Forax
forax at univ-mlv.fr
Thu Dec 21 23:46:57 UTC 2017
Hi Paul,
three things:
- I think you should add a comment to explain why you have chosen to create a the field downstream* in the primitive implementations,
I suppose it's to avoid to allocate a lambda proxy at each call.
- the fields in the inner classes cancellationRequested and downstream* should be private.
- if you use var, you should use a meaningful name, here, 's' can be replaced by 'spliterator', making the code more readable.
cheers,
Rémi
----- Mail original -----
> De: "Paul Sandoz" <paul.sandoz at oracle.com>
> À: "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Jeudi 21 Décembre 2017 23:40:18
> Objet: [10] RFR 8075939: Stream.flatMap() causes breaking of short-circuiting of terminal operations
> Hi,
>
> Please review the following webrev that makes flatMap non-aggressive when
> pushing elements downstream if any downstream operation is short-circuiting.
>
> http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8075939-flatMap-aggressive-push/webrev/index.html
> <http://cr.openjdk.java.net/~psandoz/jdk10/JDK-8075939-flatMap-aggressive-push/webrev/index.html>
>
> This enables support for flat mapping to an infinite stream (assuming there is a
> downstream short-circuiting operation to terminate the stream computation).
>
> Thanks,
> Paul.
More information about the core-libs-dev
mailing list