RFR 8071597 Add Stream dropWhile and takeWhile operations

Paul Sandoz paul.sandoz at oracle.com
Tue Jun 2 14:10:57 UTC 2015


On Jun 2, 2015, at 3:50 PM, Stefan Zobel <spliterator at gmail.com> wrote:

> Hi Paul,
> 
> Looks good.
> 
> I was wondering why the truncate method in Node.OfInt / OfLong / OfDouble
> did not receive the same
> 
> 
> +        if (to == count()) {
> +            spliterator.forEachRemaining(nodeBuilder);
> +        } else {
> +            for (int i = 0; i < size &&
> spliterator.tryAdvance(nodeBuilder); i++) { }
> +        }
> 
> 
> treatment as the truncate method in Node itself. Looks pretty symmetric to
> my untrained eyes?
> 

Indeed so, thanks for noticing. Webrev updated in place.

http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071597-take-drop-while/webrev/src/java.base/share/classes/java/util/stream/Node.java.sdiff.html

Paul.



More information about the core-libs-dev mailing list