JDK-8071597: close original Stream in default implementation?

Tagir F. Valeev amaembo at gmail.com
Wed Jul 8 02:58:01 UTC 2015


I was looking at default implementation of new Stream
takeWhile/dropWhile methods:


I think in order to make this default behavior more consistent, the
original Stream must be closed when the returned one is closed. Thus,
takeWhile return statement should look like this:

return StreamSupport.stream(
     new WhileOps.UnorderedWhileSpliterator.OfRef.Taking<>
     (spliterator(), true, predicate),

The same for dropWhile method.

What do you think?

Tagir Valeev.

More information about the core-libs-dev mailing list