RFR Collector.finisher refers to IDENTITY_TRANSFORM rather than INDENTITY_FINISH
Hi, Please review this simple fix to the JavaDoc on j.u.stream.Collector.finisher. I am also opportunistically fixing some internal comments identified by Tagir. Paul. diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/Collector.java --- a/src/java.base/share/classes/java/util/stream/Collector.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/Collector.java Thu Jul 30 17:05:13 2015 +0200 @@ -223,7 +223,7 @@ * Perform the final transformation from the intermediate accumulation type * {@code A} to the final result type {@code R}. * - * <p>If the characteristic {@code IDENTITY_TRANSFORM} is + * <p>If the characteristic {@code IDENTITY_FINISH} is * set, this function may be presumed to be an identity transform with an * unchecked cast from {@code A} to {@code R}. * diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/SliceOps.java --- a/src/java.base/share/classes/java/util/stream/SliceOps.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/SliceOps.java Thu Jul 30 17:05:13 2015 +0200 @@ -138,7 +138,7 @@ skip, limit, size); } else { - // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n) + // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE)).filter(i -> true).limit(n) // regardless of the value of n // Need to adjust the target size of splitting for the // SliceTask from say (size / k) to say min(size / k, 1 << 14) diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/Streams.java --- a/src/java.base/share/classes/java/util/stream/Streams.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/Streams.java Thu Jul 30 17:05:13 2015 +0200 @@ -156,10 +156,9 @@ * than a balanced tree at the expense of a higher-depth for the right * side of the range. * - * <p>This is optimized for cases such as IntStream.ints() that is - * implemented as range of 0 to Integer.MAX_VALUE but is likely to be - * augmented with a limit operation that limits the number of elements - * to a count lower than this threshold. + * <p>This is optimized for cases such as IntStream.range(0, Integer.MAX_VALUE) + * that is likely to be augmented with a limit operation that limits the + * number of elements to a count lower than this threshold. */ private static final int BALANCED_SPLIT_THRESHOLD = 1 << 24; @@ -280,10 +279,9 @@ * than a balanced tree at the expense of a higher-depth for the right * side of the range. * - * <p>This is optimized for cases such as LongStream.longs() that is - * implemented as range of 0 to Long.MAX_VALUE but is likely to be - * augmented with a limit operation that limits the number of elements - * to a count lower than this threshold. + * <p>This is optimized for cases such as LongStream.range(0, Long.MAX_VALUE) + * that is likely to be augmented with a limit operation that limits the + * number of elements to a count lower than this threshold. */ private static final long BALANCED_SPLIT_THRESHOLD = 1 << 24;
Hi Paul, perhaps you could take the opportunity and also add the missing "@since 1.9" tags to all the new dropWhile() / takeWhile() methods (JDK-8071597). Also in dropWhile() / takeWhile() there is a small typo (I guess) in the Javadoc: takeWhile: "takes all elements (the result is the same is the input)" dropWhile: "the stream match the given predicate then no elements are dropped (the result is the same is the input)" I guess that should read: "(the result is the same as is the input)"? Stefan 2015-07-30 17:08 GMT+02:00 Paul Sandoz <paul.sandoz@oracle.com>:
Hi,
Please review this simple fix to the JavaDoc on j.u.stream.Collector.finisher.
I am also opportunistically fixing some internal comments identified by Tagir.
Paul.
diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/Collector.java --- a/src/java.base/share/classes/java/util/stream/Collector.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/Collector.java Thu Jul 30 17:05:13 2015 +0200 @@ -223,7 +223,7 @@ * Perform the final transformation from the intermediate accumulation type * {@code A} to the final result type {@code R}. * - * <p>If the characteristic {@code IDENTITY_TRANSFORM} is + * <p>If the characteristic {@code IDENTITY_FINISH} is * set, this function may be presumed to be an identity transform with an * unchecked cast from {@code A} to {@code R}. * diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/SliceOps.java --- a/src/java.base/share/classes/java/util/stream/SliceOps.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/SliceOps.java Thu Jul 30 17:05:13 2015 +0200 @@ -138,7 +138,7 @@ skip, limit, size); } else { - // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n) + // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE)).filter(i -> true).limit(n) // regardless of the value of n // Need to adjust the target size of splitting for the // SliceTask from say (size / k) to say min(size / k, 1 << 14) diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/Streams.java --- a/src/java.base/share/classes/java/util/stream/Streams.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/Streams.java Thu Jul 30 17:05:13 2015 +0200 @@ -156,10 +156,9 @@ * than a balanced tree at the expense of a higher-depth for the right * side of the range. * - * <p>This is optimized for cases such as IntStream.ints() that is - * implemented as range of 0 to Integer.MAX_VALUE but is likely to be - * augmented with a limit operation that limits the number of elements - * to a count lower than this threshold. + * <p>This is optimized for cases such as IntStream.range(0, Integer.MAX_VALUE) + * that is likely to be augmented with a limit operation that limits the + * number of elements to a count lower than this threshold. */ private static final int BALANCED_SPLIT_THRESHOLD = 1 << 24;
@@ -280,10 +279,9 @@ * than a balanced tree at the expense of a higher-depth for the right * side of the range. * - * <p>This is optimized for cases such as LongStream.longs() that is - * implemented as range of 0 to Long.MAX_VALUE but is likely to be - * augmented with a limit operation that limits the number of elements - * to a count lower than this threshold. + * <p>This is optimized for cases such as LongStream.range(0, Long.MAX_VALUE) + * that is likely to be augmented with a limit operation that limits the + * number of elements to a count lower than this threshold. */ private static final long BALANCED_SPLIT_THRESHOLD = 1 << 24;
Hi Stefan, Tagir, Updated: http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8130828-stream-doc-typos/webrev... Paul. On 30 Jul 2015, at 18:08, Stefan Zobel <spliterator@gmail.com> wrote:
Hi Paul,
perhaps you could take the opportunity and also add the missing "@since 1.9" tags to all the new dropWhile() / takeWhile() methods (JDK-8071597).
Also in dropWhile() / takeWhile() there is a small typo (I guess) in the Javadoc:
takeWhile: "takes all elements (the result is the same is the input)"
dropWhile: "the stream match the given predicate then no elements are dropped (the result is the same is the input)"
I guess that should read: "(the result is the same as is the input)"?
Stefan
Hi Paul, looks good. Stefan 2015-07-30 18:32 GMT+02:00 Paul Sandoz <paul.sandoz@oracle.com>:
Hi Stefan, Tagir,
Updated:
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8130828-stream-doc-typos/webrev...
Paul.
Hi Paul, Changes look good. (The webrev changesets are a bit odd, though; are you running webrev on a branchy repo or something?) Stefan, Tagir, thanks for spotting these issues. s'marks On 7/30/15 9:32 AM, Paul Sandoz wrote:
Hi Stefan, Tagir,
Updated:
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8130828-stream-doc-typos/webrev...
Paul.
On 30 Jul 2015, at 18:08, Stefan Zobel <spliterator@gmail.com> wrote:
Hi Paul,
perhaps you could take the opportunity and also add the missing "@since 1.9" tags to all the new dropWhile() / takeWhile() methods (JDK-8071597).
Also in dropWhile() / takeWhile() there is a small typo (I guess) in the Javadoc:
takeWhile: "takes all elements (the result is the same is the input)"
dropWhile: "the stream match the given predicate then no elements are dropped (the result is the same is the input)"
I guess that should read: "(the result is the same as is the input)"?
Stefan
On 31 Jul 2015, at 01:32, Stuart Marks <stuart.marks@oracle.com> wrote:
Hi Paul,
Changes look good.
Thanks.
(The webrev changesets are a bit odd, though; are you running webrev on a branchy repo or something?)
No, nothing special, but something has changed that is making the webrev script behave differently. Paul.
Stefan, Tagir, thanks for spotting these issues.
s'marks
On 7/30/15 9:32 AM, Paul Sandoz wrote:
Hi Stefan, Tagir,
Updated:
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8130828-stream-doc-typos/webrev...
Paul.
On 30 Jul 2015, at 18:08, Stefan Zobel <spliterator@gmail.com> wrote:
Hi Paul,
perhaps you could take the opportunity and also add the missing "@since 1.9" tags to all the new dropWhile() / takeWhile() methods (JDK-8071597).
Also in dropWhile() / takeWhile() there is a small typo (I guess) in the Javadoc:
takeWhile: "takes all elements (the result is the same is the input)"
dropWhile: "the stream match the given predicate then no elements are dropped (the result is the same is the input)"
I guess that should read: "(the result is the same as is the input)"?
Stefan
Hello! Seems that you have an extra parenthesis here: diff -r 4e3135fac8cc src/java.base/share/classes/java/util/stream/SliceOps.java --- a/src/java.base/share/classes/java/util/stream/SliceOps.java Fri Jul 24 15:33:13 2015 -0700 +++ b/src/java.base/share/classes/java/util/stream/SliceOps.java Thu Jul 30 17:05:13 2015 +0200 @@ -138,7 +138,7 @@ skip, limit, size); } else { - // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n) + // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE)).filter(i -> true).limit(n) Should be + // @@@ OOMEs will occur for LongStream.range(0, Long.MAX_VALUE).filter(i -> true).limit(n) With best regards, Tagir Valeev.
participants (4)
-
Paul Sandoz
-
Stefan Zobel
-
Stuart Marks
-
Tagir F. Valeev