changeset 8364:4c67fc5c66ce

Adapt review comments
author henryjen
date Thu, 25 Apr 2013 12:15:33 -0700
parents 9251c488cf27
children 4253e2ac200b
files src/share/classes/java/util/Arrays.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
diffstat 4 files changed, 32 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Arrays.java	Wed Apr 24 23:10:19 2013 -0700
+++ b/src/share/classes/java/util/Arrays.java	Thu Apr 25 12:15:33 2013 -0700
@@ -4528,7 +4528,7 @@
      */
     public static<T> void setAll(T[] array, IntFunction<? extends T> generator) {
         Objects.requireNonNull(generator);
-        for (int i=0; i<array.length; i++)
+        for (int i = 0; i < array.length; i++)
             array[i] = generator.apply(i);
     }
 
@@ -4567,7 +4567,7 @@
      */
     public static void setAll(int[] array, IntUnaryOperator generator) {
         Objects.requireNonNull(generator);
-        for (int i=0; i<array.length; i++)
+        for (int i = 0; i < array.length; i++)
             array[i] = generator.applyAsInt(i);
     }
 
@@ -4605,7 +4605,7 @@
      */
     public static void setAll(long[] array, IntToLongFunction generator) {
         Objects.requireNonNull(generator);
-        for (int i=0; i<array.length; i++)
+        for (int i = 0; i < array.length; i++)
             array[i] = generator.applyAsLong(i);
     }
 
@@ -4643,7 +4643,7 @@
      */
     public static void setAll(double[] array, IntToDoubleFunction generator) {
         Objects.requireNonNull(generator);
-        for (int i=0; i<array.length; i++)
+        for (int i = 0; i < array.length; i++)
             array[i] = generator.applyAsDouble(i);
     }
 
@@ -4827,7 +4827,7 @@
      *
      * @param <T> The type of the array elements
      * @param array The array, assumed to be unmodified during use
-     * @return A {@code Stream} from the array
+     * @return A {@code Stream} for the array
      * @since 1.8
      */
     public static <T> Stream<T> stream(T[] array) {
@@ -4835,7 +4835,7 @@
     }
 
     /**
-     * Returns a sequential {@link Stream} with specified range of the
+     * Returns a sequential {@link Stream} with the specified range of the
      * specified array as its source.
      *
      * @param <T> The type of the array elements
@@ -4843,7 +4843,7 @@
      * @param fromIndex The index of the first element (inclusive) to be
      *        encountered
      * @param toIndex One past the index of the last element to be encountered
-     * @return A {@code Stream} from the array
+     * @return A {@code Stream} for the array
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
      *         {@code toIndex} is less than {@code fromIndex}, or
      *         {@code toIndex} is greater than the array size
@@ -4858,7 +4858,7 @@
      * source.
      *
      * @param array The array, assumed to be unmodified during use
-     * @return An {@code IntStream} from the array
+     * @return An {@code IntStream} for the array
      * @since 1.8
      */
     public static IntStream stream(int[] array) {
@@ -4866,14 +4866,14 @@
     }
 
     /**
-     * Returns a sequential {@link IntStream} with specified range of the
+     * Returns a sequential {@link IntStream} with the specified range of the
      * specified array as its source.
      *
      * @param array The array, assumed to be unmodified during use
      * @param fromIndex The index of the first element (inclusive) to be
      *        encountered
      * @param toIndex One past the index of the last element to be encountered
-     * @return An {@code IntStream} from the array
+     * @return An {@code IntStream} for the array
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
      *         {@code toIndex} is less than {@code fromIndex}, or
      *         {@code toIndex} is greater than the array size
@@ -4888,7 +4888,7 @@
      * source.
      *
      * @param array The array, assumed to be unmodified during use
-     * @return A {@code LongStream} from the array
+     * @return A {@code LongStream} for the array
      * @since 1.8
      */
     public static LongStream stream(long[] array) {
@@ -4896,14 +4896,14 @@
     }
 
     /**
-     * Returns a sequential {@link LongStream} with specified range of the
+     * Returns a sequential {@link LongStream} with the specified range of the
      * specified array as its source.
      *
      * @param array The array, assumed to be unmodified during use
      * @param fromIndex The index of the first element (inclusive) to be
      *        encountered
      * @param toIndex One past the index of the last element to be encountered
-     * @return A {@code LongStream} from the array
+     * @return A {@code LongStream} for the array
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
      *         {@code toIndex} is less than {@code fromIndex}, or
      *         {@code toIndex} is greater than the array size
@@ -4918,7 +4918,7 @@
      * source.
      *
      * @param array The array, assumed to be unmodified during use
-     * @return A {@code DoubleStream} from the array
+     * @return A {@code DoubleStream} for the array
      * @since 1.8
      */
     public static DoubleStream stream(double[] array) {
@@ -4926,14 +4926,14 @@
     }
 
     /**
-     * Returns a sequential {@link DoubleStream} with specified range of the
+     * Returns a sequential {@link DoubleStream} with the specified range of the
      * specified array as its source.
      *
      * @param array The array, assumed to be unmodified during use
      * @param fromIndex The index of the first element (inclusive) to be
      *        encountered
      * @param toIndex One past the index of the last element to be encountered
-     * @return A {@code DoubleStream} from the array
+     * @return A {@code DoubleStream} for the array
      * @throws ArrayIndexOutOfBoundsException if {@code fromIndex} is negative,
      *         {@code toIndex} is less than {@code fromIndex}, or
      *         {@code toIndex} is greater than the array size
--- a/src/share/classes/java/util/stream/DoubleStream.java	Wed Apr 24 23:10:19 2013 -0700
+++ b/src/share/classes/java/util/stream/DoubleStream.java	Thu Apr 25 12:15:33 2013 -0700
@@ -775,9 +775,9 @@
 
     /**
      * Returns a sequential {@code DoubleStream} from {@code startInclusive}
-     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}.
-     * If {@code startInclusive} is greater than {@code endExclusive}, an empty
-     * stream is returned.
+     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+     * {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
      *
      * An equivalent sequence of increasing values can be produced
      * sequentially using a {@code for} loop as follows:
@@ -806,7 +806,7 @@
         //     than expected
         if (step <= 0 || Double.isNaN(step))
             throw new IllegalArgumentException(String.format("Illegal step: %f", step));
-        else if (startInclusive > endExclusive)
+        else if (startInclusive >= endExclusive)
             return empty();
         else {
             double size = Math.ceil((endExclusive - startInclusive) / step);
--- a/src/share/classes/java/util/stream/IntStream.java	Wed Apr 24 23:10:19 2013 -0700
+++ b/src/share/classes/java/util/stream/IntStream.java	Thu Apr 25 12:15:33 2013 -0700
@@ -776,12 +776,12 @@
     }
 
     /**
-     * Returns a sequential {@code IntStream} from {@code startInclusive} (inclusive)
-     * to {@code endExclusive} (exclusive) by a non-negative {@code step}.
-     * If {@code startInclusive} is greater than {@code endExclusive}, an empty
-     * stream is returned.
-     * <p>
-     * An equivalent sequence of increasing values can be produced
+     * Returns a sequential {@code IntStream} from {@code startInclusive}
+     * (inclusive) to {@code endExclusive} (exclusive) by a positive {@code
+     * step}.  If {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
+     *
+     * <p>An equivalent sequence of increasing values can be produced
      * sequentially using a {@code for} loop as follows:
      * <pre>{@code
      *     for (int i = startInclusive; i < endExclusive ; i += step) { ... }
@@ -789,7 +789,7 @@
      *
      * @param startInclusive the (inclusive) initial value
      * @param endExclusive the exclusive upper bound
-     * @param step the non-negative difference between consecutive values
+     * @param step the positive difference between consecutive values
      * @return A sequential {@code IntStream} for a range of {@code int}
      *         elements
      * @throws IllegalArgumentException
@@ -798,7 +798,7 @@
     public static IntStream range(int startInclusive, int endExclusive, int step) {
         if (step <= 0)
             throw new IllegalArgumentException(String.format("Illegal step: %d", step));
-        else if (startInclusive > endExclusive)
+        else if (startInclusive >= endExclusive)
             return empty();
         else
             return StreamSupport.intStream(new Streams.RangeIntSpliterator(startInclusive, endExclusive, step));
--- a/src/share/classes/java/util/stream/LongStream.java	Wed Apr 24 23:10:19 2013 -0700
+++ b/src/share/classes/java/util/stream/LongStream.java	Thu Apr 25 12:15:33 2013 -0700
@@ -768,9 +768,9 @@
 
     /**
      * Returns a sequential {@code LongStream} from {@code startInclusive}
-     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}.
-     * If {@code startInclusive} is greater than {@code endExclusive}, an empty
-     * stream is returned.
+     * (inclusive) to {@code endExclusive} (exclusive) by {@code step}. If
+     * {@code startInclusive} is greater than or equal to {@code
+     * endExclusive}, an empty stream is returned.
      *
      * <p>An equivalent sequence of increasing values can be produced
      * sequentially using a {@code for} loop as follows:
@@ -789,7 +789,7 @@
     public static LongStream range(long startInclusive, final long endExclusive, final long step) {
         if (step <= 0)
             throw new IllegalArgumentException(String.format("Illegal step: %d", step));
-        else if (startInclusive > endExclusive)
+        else if (startInclusive >= endExclusive)
             return empty();
         else
             return StreamSupport.longStream(new Streams.RangeLongSpliterator(startInclusive, endExclusive, step));