src/share/classes/java/util/stream/DoubleStream.java
Print this page
rev 7982 : 8017513: Support for closeable streams
8022237: j.u.s.BaseStream.onClose() has an issue in implementation or requires spec clarification
8022572: Same exception instances thrown from j.u.stream.Stream.onClose() handlers are not listed as suppressed
Summary: BaseStream implements AutoCloseable; Remove CloseableStream and DelegatingStream
Reviewed-by: alanb, mduigou, psandoz
Contributed-by: brian.goetz@oracle.com
*** 750,760 ****
/**
* Creates a lazy concatenated {@code DoubleStream} whose elements are all the
* elements of a first {@code DoubleStream} succeeded by all the elements of the
* second {@code DoubleStream}. The resulting stream is ordered if both
* of the input streams are ordered, and parallel if either of the input
! * streams is parallel.
*
* @param a the first stream
* @param b the second stream to concatenate on to end of the first stream
* @return the concatenation of the two streams
*/
--- 750,761 ----
/**
* Creates a lazy concatenated {@code DoubleStream} whose elements are all the
* elements of a first {@code DoubleStream} succeeded by all the elements of the
* second {@code DoubleStream}. The resulting stream is ordered if both
* of the input streams are ordered, and parallel if either of the input
! * streams is parallel. When the resulting stream is closed, the close
! * handlers for both input streams are invoked.
*
* @param a the first stream
* @param b the second stream to concatenate on to end of the first stream
* @return the concatenation of the two streams
*/
*** 762,772 ****
Objects.requireNonNull(a);
Objects.requireNonNull(b);
Spliterator.OfDouble split = new Streams.ConcatSpliterator.OfDouble(
a.spliterator(), b.spliterator());
! return StreamSupport.doubleStream(split, a.isParallel() || b.isParallel());
}
/**
* A mutable builder for a {@code DoubleStream}.
*
--- 763,774 ----
Objects.requireNonNull(a);
Objects.requireNonNull(b);
Spliterator.OfDouble split = new Streams.ConcatSpliterator.OfDouble(
a.spliterator(), b.spliterator());
! DoubleStream stream = StreamSupport.doubleStream(split, a.isParallel() || b.isParallel());
! return stream.onClose(Streams.composedClose(a, b));
}
/**
* A mutable builder for a {@code DoubleStream}.
*