hg: Move static stream construction methods from Streams to Stream, {Int, Long, Double}Stream
Stephen Colebourne
scolebourne at joda.org
Sun Apr 21 03:49:09 PDT 2013
Two comments:
public static IntStream singleton(int t) {...}
public static IntStream of(int... values) {...}
These two serve similar purposes, yet have different method names.
There is also no special casing of a single entry (or zero entries) in
the of() method implementation. Please consider one of these options:
a) remove singleton(x), allowing users to just use of(x).
b) change to of(int), of(int...)
c) change to ofSingleton(int), of(int, int...)
d) change to of(int), of(int, int...)
While empty() is also similarly affected and could be of(), I have
less problem with the special method name in that case. Equally, I
would be happy with ofEmpty().
IntStream range(int start, int end) {...}
My dislike of the <= end range for int is well-known. Given that seems
unlikely to change, can we please make a small tweak to the method
signature:
IntStream range(int startInclusive, int endExclusive) {...}
By changing the names of the parameters to specify
exclsuive/inclusive, IDEs will show this when filling out the method
during coding. It does not help with reading the resulting code, but
it is a big help with writing range code. I have used this parameter
naming technique for many years (including Apache commons) and can
attest to its usefulness. Note that having the Javadoc specify
exclusive/inclusive (as it does) is nowhere near as useful when
coding.
Stephen
On 21 April 2013 04:41, <brian.goetz at oracle.com> wrote:
> Changeset: a699ac548600
> Author: briangoetz
> Date: 2013-04-20 18:56 -0400
> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/a699ac548600
>
> Move static stream construction methods from Streams to Stream, {Int,Long,Double}Stream
>
> ! src/share/classes/java/util/Arrays.java
> ! src/share/classes/java/util/Collections.java
> ! src/share/classes/java/util/Random.java
> ! src/share/classes/java/util/concurrent/ThreadLocalRandom.java
> ! src/share/classes/java/util/stream/DoubleStream.java
> ! src/share/classes/java/util/stream/IntStream.java
> ! src/share/classes/java/util/stream/LongStream.java
> ! src/share/classes/java/util/stream/Stream.java
> ! src/share/classes/java/util/stream/StreamBuilder.java
> ! src/share/classes/java/util/stream/Streams.java
> ! src/share/classes/java/util/stream/package-info.java
> ! test-ng/bootlib/java/util/stream/DoubleStreamTestDataProvider.java
> ! test-ng/bootlib/java/util/stream/IntStreamTestDataProvider.java
> ! test-ng/bootlib/java/util/stream/LambdaTestHelpers.java
> ! test-ng/bootlib/java/util/stream/LongStreamTestDataProvider.java
> ! test-ng/boottests/java/util/stream/SpinedBufferTest.java
> ! test-ng/boottests/java/util/stream/StreamFlagsTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/DoublePrimitiveOpsTests.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/ExplodeOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/ForEachOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/IntPrimitiveOpsTests.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/IntReduceTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/IntSliceOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/IntUniqOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/LongPrimitiveOpsTests.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/MatchOpTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/MinMaxTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/RangeTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/StreamBuilderTest.java
> ! test-ng/tests/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java
> ! test/java/util/stream/Stream/EmployeeStreamTest.java
> ! test/java/util/stream/Stream/IntStreamTest.java
> ! test/java/util/stream/Stream/IntegerStreamTest.java
> ! test/java/util/stream/Stream/StringBuilderStreamTest.java
> ! test/java/util/stream/Streams/BasicTest.java
>
>
More information about the lambda-dev
mailing list