changeset 9100:68eb0c55a8c0

8032190: Specifications of stream flatMap methods should require mapped streams to be closed Reviewed-by: chegar, alanb
author psandoz
date Tue, 21 Jan 2014 10:49:49 +0100
parents 57c26829deb6
children a41ff4b552b2 4d891c8db5c1 a9088d517f2f
files 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
diffstat 4 files changed, 37 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/DoubleStream.java	Wed Jan 22 19:06:08 2014 -0500
+++ b/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/src/share/classes/java/util/stream/IntStream.java	Wed Jan 22 19:06:08 2014 -0500
+++ b/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/src/share/classes/java/util/stream/LongStream.java	Wed Jan 22 19:06:08 2014 -0500
+++ b/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/src/share/classes/java/util/stream/Stream.java	Wed Jan 22 19:06:08 2014 -0500
+++ b/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>.