--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java Sat Jun 08 09:05:49 2013 -0700
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java Mon Jun 10 11:52:32 2013 +0200
@@ -753,75 +753,4 @@
},
Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
}
-
- /**
- * Returns a sequential {@code DoubleStream} from {@code startInclusive} (inclusive)
- * to {@code endExclusive} (exclusive) by an incremental step of 1.0.
- *
- * @implSpec
- * The implementation behaves as if:
- * <pre>{@code
- * doubleRange(startInclusive, endExclusive, 1.0);
- * }</pre>
- *
- * @param startInclusive the (inclusive) initial value
- * @param endExclusive the exclusive upper bound
- * @return a sequential {@code DoubleStream} for the range of {@code double}
- * elements
- */
- public static DoubleStream range(double startInclusive, double endExclusive) {
- return range(startInclusive, endExclusive, 1.0);
- }
-
- /**
- * Returns a sequential {@code DoubleStream} from {@code startInclusive}
- * (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:
- * <pre>{@code
- * long size = (long) Math.ceil((startInclusive - endExclusive) / step);
- * long i = 0
- * for (double v = startInclusive; i < size; i++, v = startInclusive + step * i) {
- * ...
- * }
- * }</pre>
- *
- * @param startInclusive the (inclusive) initial value
- * @param endExclusive the exclusive upper bound
- * @param step the difference between consecutive values
- * @return a sequential {@code DoubleStream} for tne range of {@code double}
- * elements
- * @throws IllegalArgumentException if {@code step} is less than or equal to
- * 0. is {@code NaN}, or the count of elements in the range would be
- * greater than {@code Long.MAX_VALUE}
- */
- public static DoubleStream range(double startInclusive, double endExclusive, double step) {
- // @@@ Need to check for ranges that may not produce distinct values
- // such as when the step is very small
- // Also clarify the size of the range which may produce more or less
- // than expected
- if (step <= 0 || Double.isNaN(step)) {
- throw new IllegalArgumentException(String.format("Illegal step: %f", step));
- } else {
- double range = endExclusive - startInclusive;
- if (range <= 0) {
- return empty();
- }
- double size = Math.ceil((endExclusive - startInclusive) / step);
- if (Double.isNaN(size)) {
- throw new IllegalArgumentException(
- String.format("Illegal range: %f size is NaN", size));
- } else if (size > Long.MAX_VALUE) {
- throw new IllegalArgumentException(
- String.format("Illegal range: size %f > Long.MAX_VALUE", size));
- } else {
- return StreamSupport.doubleStream(
- new Streams.RangeDoubleSpliterator(
- startInclusive, endExclusive, step, 0, (long) size));
- }
- }
- }
}