From ba39efdf122e3c834d6686eed6047da9ffcc85b8 Mon Sep 17 00:00:00 2001 From: psandoz Date: Tue, 21 Jan 2014 10:49:49 +0100 Subject: [PATCH] 8032190: Specifications of stream flatMap methods should require mapped streams to be closed Reviewed-by: chegar, alanb --- .../java/util/stream/DoubleStream.java | 9 +++-- .../classes/java/util/stream/IntStream.java | 9 +++-- .../classes/java/util/stream/LongStream.java | 9 +++-- .../classes/java/util/stream/Stream.java | 40 ++++++++++--------- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/share/classes/java/util/stream/DoubleStream.java b/src/share/classes/java/util/stream/DoubleStream.java index f94179eb0..4d5d23d49 100644 --- a/src/share/classes/java/util/stream/DoubleStream.java +++ b/src/share/classes/java/util/stream/DoubleStream.java @@ -150,10 +150,11 @@ public interface DoubleStream extends BaseStream { /** * 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.) * *

This is an intermediate * operation. diff --git a/src/share/classes/java/util/stream/IntStream.java b/src/share/classes/java/util/stream/IntStream.java index 83992f317..94c2924fc 100644 --- a/src/share/classes/java/util/stream/IntStream.java +++ b/src/share/classes/java/util/stream/IntStream.java @@ -146,10 +146,11 @@ public interface IntStream extends BaseStream { /** * 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.) * *

This is an intermediate * operation. diff --git a/src/share/classes/java/util/stream/LongStream.java b/src/share/classes/java/util/stream/LongStream.java index c3901006d..a2d429e5a 100644 --- a/src/share/classes/java/util/stream/LongStream.java +++ b/src/share/classes/java/util/stream/LongStream.java @@ -151,10 +151,11 @@ public interface LongStream extends BaseStream { /** * 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.) * *

This is an intermediate * operation. diff --git a/src/share/classes/java/util/stream/Stream.java b/src/share/classes/java/util/stream/Stream.java index 966cd7913..c35fc0568 100644 --- a/src/share/classes/java/util/stream/Stream.java +++ b/src/share/classes/java/util/stream/Stream.java @@ -227,10 +227,11 @@ public interface Stream extends BaseStream> { /** * 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.) * *

This is an intermediate * operation. @@ -270,10 +271,11 @@ public interface Stream extends BaseStream> { /** * 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.) * *

This is an intermediate * operation. @@ -288,11 +290,12 @@ public interface Stream extends BaseStream> { IntStream flatMapToInt(Function 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.) * *

This is an intermediate * operation. @@ -307,11 +310,12 @@ public interface Stream extends BaseStream> { LongStream flatMapToLong(Function 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.) * *

This is an intermediate * operation. -- GitLab