8032190: It's unclear that flatMap will ensure each stream will be closed.
authorpsandoz
Tue, 21 Jan 2014 10:49:49 +0100
changeset 22352 ecbf37860ffa
parent 22351 d8ac878ba804
child 22353 d09e3ff5fd63
8032190: It's unclear that flatMap will ensure each stream will be closed. Reviewed-by: chegar, alanb
jdk/src/share/classes/java/util/stream/DoubleStream.java
jdk/src/share/classes/java/util/stream/IntStream.java
jdk/src/share/classes/java/util/stream/LongStream.java
jdk/src/share/classes/java/util/stream/Stream.java
--- a/jdk/src/share/classes/java/util/stream/DoubleStream.java	Tue Jan 21 09:33:48 2014 +0000
+++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java	Tue Jan 21 10:49:49 2014 +0100
@@ -150,10 +150,11 @@
 
     /**
      * Returns a stream consisting of the results of replacing each element of
-     * this stream with the contents of the stream produced by applying the
-     * provided mapping function to each element.  (If the result of the mapping
-     * function is {@code null}, this is treated as if the result was an empty
-     * stream.)
+     * this stream with the contents of a mapped stream produced by applying
+     * the provided mapping function to each element.  Each mapped stream is
+     * {@link java.util.stream.BaseStream#close() closed} after its contents
+     * have been placed into this stream.  (If a mapped stream is {@code null}
+     * an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
--- a/jdk/src/share/classes/java/util/stream/IntStream.java	Tue Jan 21 09:33:48 2014 +0000
+++ b/jdk/src/share/classes/java/util/stream/IntStream.java	Tue Jan 21 10:49:49 2014 +0100
@@ -146,10 +146,11 @@
 
     /**
      * Returns a stream consisting of the results of replacing each element of
-     * this stream with the contents of the stream produced by applying the
-     * provided mapping function to each element.  (If the result of the mapping
-     * function is {@code null}, this is treated as if the result was an empty
-     * stream.)
+     * this stream with the contents of a mapped stream produced by applying
+     * the provided mapping function to each element.  Each mapped stream is
+     * {@link java.util.stream.BaseStream#close() closed} after its contents
+     * have been placed into this stream.  (If a mapped stream is {@code null}
+     * an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
--- a/jdk/src/share/classes/java/util/stream/LongStream.java	Tue Jan 21 09:33:48 2014 +0000
+++ b/jdk/src/share/classes/java/util/stream/LongStream.java	Tue Jan 21 10:49:49 2014 +0100
@@ -151,10 +151,11 @@
 
     /**
      * Returns a stream consisting of the results of replacing each element of
-     * this stream with the contents of the stream produced by applying the
-     * provided mapping function to each element.  (If the result of the mapping
-     * function is {@code null}, this is treated as if the result was an empty
-     * stream.)
+     * this stream with the contents of a mapped stream produced by applying
+     * the provided mapping function to each element.  Each mapped stream is
+     * {@link java.util.stream.BaseStream#close() closed} after its contents
+     * have been placed into this stream.  (If a mapped stream is {@code null}
+     * an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
--- a/jdk/src/share/classes/java/util/stream/Stream.java	Tue Jan 21 09:33:48 2014 +0000
+++ b/jdk/src/share/classes/java/util/stream/Stream.java	Tue Jan 21 10:49:49 2014 +0100
@@ -227,10 +227,11 @@
 
     /**
      * Returns a stream consisting of the results of replacing each element of
-     * this stream with the contents of the stream produced by applying the
-     * provided mapping function to each element.  (If the result of the mapping
-     * function is {@code null}, this is treated as if the result was an empty
-     * stream.)
+     * this stream with the contents of a mapped stream produced by applying
+     * the provided mapping function to each element.  Each mapped stream is
+     * {@link java.util.stream.BaseStream#close() closed} after its contents
+     * have been placed into this stream.  (If a mapped stream is {@code null}
+     * an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
@@ -270,10 +271,11 @@
 
     /**
      * Returns an {@code IntStream} consisting of the results of replacing each
-     * element of this stream with the contents of the stream produced by
-     * applying the provided mapping function to each element.  (If the result
-     * of the mapping function is {@code null}, this is treated as if the result
-     * was an empty stream.)
+     * element of this stream with the contents of a mapped stream produced by
+     * applying the provided mapping function to each element.  Each mapped
+     * stream is {@link java.util.stream.BaseStream#close() closed} after its
+     * contents have been placed into this stream.  (If a mapped stream is
+     * {@code null} an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
@@ -288,11 +290,12 @@
     IntStream flatMapToInt(Function<? super T, ? extends IntStream> mapper);
 
     /**
-     * Returns a {@code LongStream} consisting of the results of replacing each
-     * element of this stream with the contents of the stream produced
-     * by applying the provided mapping function to each element.  (If the result
-     * of the mapping function is {@code null}, this is treated as if the result
-     * was an empty stream.)
+     * Returns an {@code LongStream} consisting of the results of replacing each
+     * element of this stream with the contents of a mapped stream produced by
+     * applying the provided mapping function to each element.  Each mapped
+     * stream is {@link java.util.stream.BaseStream#close() closed} after its
+     * contents have been placed into this stream.  (If a mapped stream is
+     * {@code null} an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.
@@ -307,11 +310,12 @@
     LongStream flatMapToLong(Function<? super T, ? extends LongStream> mapper);
 
     /**
-     * Returns a {@code DoubleStream} consisting of the results of replacing each
-     * element of this stream with the contents of the stream produced
-     * by applying the provided mapping function to each element.  (If the result
-     * of the mapping function is {@code null}, this is treated as if the result
-     * was an empty stream.)
+     * Returns an {@code DoubleStream} consisting of the results of replacing
+     * each element of this stream with the contents of a mapped stream produced
+     * by applying the provided mapping function to each element.  Each mapped
+     * stream is {@link java.util.stream.BaseStream#close() closed} after its
+     * contents have placed been into this stream.  (If a mapped stream is
+     * {@code null} an empty stream is used, instead.)
      *
      * <p>This is an <a href="package-summary.html#StreamOps">intermediate
      * operation</a>.