changeset 9682:0db2654ecd25

JDK-8024339: clarify @throw behavior for Optional-bearing stream methods
author briangoetz
date Thu, 05 Sep 2013 11:11:09 -0400
parents 7d3546bac60e
children a4babe938c8c
files src/share/classes/java/util/stream/Stream.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/Stream.java	Tue Sep 03 14:53:59 2013 -0700
+++ b/src/share/classes/java/util/stream/Stream.java	Thu Sep 05 11:11:09 2013 -0400
@@ -557,7 +557,8 @@
      * @param accumulator an <a href="package-summary.html#Associativity">associative</a>
      *                    <a href="package-summary.html#NonInterference">non-interfering,
      *                    stateless</a> function for combining two values
-     * @return the result of the reduction
+     * @return an {@link Optional} describing the result of the reduction
+     * @throws NullPointerException if the result of the reduction is null
      * @see #reduce(Object, BinaryOperator)
      * @see #min(java.util.Comparator)
      * @see #max(java.util.Comparator)
@@ -728,6 +729,7 @@
      *                   elements of this stream
      * @return an {@code Optional} describing the minimum element of this stream,
      * or an empty {@code Optional} if the stream is empty
+     * @throws NullPointerException if the minimum element is null
      */
     Optional<T> min(Comparator<? super T> comparator);
 
@@ -744,6 +746,7 @@
      *                   elements of this stream
      * @return an {@code Optional} describing the maximum element of this stream,
      * or an empty {@code Optional} if the stream is empty
+     * @throws NullPointerException if the maximum element is null
      */
     Optional<T> max(Comparator<? super T> comparator);