[10] RFR 8075939: Stream.flatMap() causes breaking of short-circuiting of terminal operations

Paul Sandoz paul.sandoz at oracle.com
Fri Dec 22 00:38:37 UTC 2017

> On 21 Dec 2017, at 15:46, Remi Forax <forax at univ-mlv.fr> wrote:
> 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.

Yes, i included this comment:
// cache the consumer to avoid creation on every accepted element

> - the fields in the inner classes cancellationRequested and downstream* should be private.

Does it make any difference for such inner classes? (I lean towards package private as the default.)

> - if you use var, you should use a meaningful name, here, 's' can be replaced by 'spliterator', making the code more readable.

Don’t agree in this case, given the locality of use and given the method name on the RHS.


More information about the core-libs-dev mailing list