changeset 7523:752249e6e1d9

Doc nits based on review comments
author briangoetz
date Fri, 22 Feb 2013 13:17:05 -0500
parents 5c97c99f2d72
children 9b2d5bf5f4d9
files src/share/classes/java/util/stream/DistinctOp.java src/share/classes/java/util/stream/IntermediateOp.java src/share/classes/java/util/stream/StatefulOp.java src/share/classes/java/util/stream/Stream.java src/share/classes/java/util/stream/TerminalOp.java
diffstat 5 files changed, 19 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/DistinctOp.java	Fri Feb 22 12:59:59 2013 -0500
+++ b/src/share/classes/java/util/stream/DistinctOp.java	Fri Feb 22 13:17:05 2013 -0500
@@ -151,7 +151,7 @@
     }
 
     /**
-     * A abstract {@code Sink} implementation that does duplicate removal
+     * An abstract {@code Sink} implementation that does duplicate removal
      * @param <S> Input element type to the stream pipeline
      * @param <T> Output element type from the stream pipeline
      */
--- a/src/share/classes/java/util/stream/IntermediateOp.java	Fri Feb 22 12:59:59 2013 -0500
+++ b/src/share/classes/java/util/stream/IntermediateOp.java	Fri Feb 22 13:17:05 2013 -0500
@@ -28,8 +28,7 @@
  * An operation in a stream pipeline that takes a stream as input and produces a stream, possibly of a different
  * type, as output.  An intermediate operation has an input type and an output type (and, an associated input
  * shape and output shape).  An intermediate operation also has a set of <em>operation flags</em> that describes
- * how the operation transforms characteristics of the stream (such as sortedness or size; see
- * {@link StreamOpFlag}).
+ * how it transforms characteristics of the stream (such as sortedness or size; see {@link StreamOpFlag}).
  *
  * <p>Intermediate operations are implemented in terms of <em>sink transforms</em>; given a {@code Sink} for the
  * output type of the operation, produce a {@code Sink} for the input type of the operation, which, when fed with
@@ -38,7 +37,16 @@
  *
  * <p>Some intermediate operations are <em>stateful</em>.  This means that the sinks they produce as a result of
  * the above wrapping may maintain state from processing earlier elements.  Stateful intermediate operations must
- * implement the {@link StatefulOp} interface.
+ * implement the {@link StatefulOp} interface.  Statefulness has an effect on how the operation can be parallelized.
+ * Stateless operations parallelize trivially because they are homomorphisms under concatenation:
+ *
+ * <pre>
+ *     statelessOp(a || b) = statelessOp(a) || statelessOp(b)
+ * </pre>
+ *
+ * where {@code ||} denotes concatenation.  Stateful operations may still be parallelizable, but are not amenable to
+ * the automatic parallelization of stateless operations.  Accordingly, a stateful operation must provide its
+ * own parallel execution implementation ({@link StatefulOp#evaluateParallel(PipelineHelper)}).
  *
  * @apiNote
  * As an example, consider the stream pipeline:
@@ -99,7 +107,7 @@
      *
      * @implSpec The default implementation returns {@code false}.
      *
-     * @return {@code true} then operation is stateful
+     * @return {@code true} if this operation is stateful
      */
     default boolean isStateful() { return false; }
 
--- a/src/share/classes/java/util/stream/StatefulOp.java	Fri Feb 22 12:59:59 2013 -0500
+++ b/src/share/classes/java/util/stream/StatefulOp.java	Fri Feb 22 13:17:05 2013 -0500
@@ -23,13 +23,12 @@
 interface StatefulOp<E> extends IntermediateOp<E, E> {
 
     /**
-     * @{inheritDoc}
      * This method must return {@code true}
-     * @implSpec The default implementations returns {@code true}
+     * @implSpec The default implementation returns {@code true}
      * @return {@code true}
      */
     @Override
-    public default boolean isStateful() {
+    default boolean isStateful() {
         return true;
     }
 
--- a/src/share/classes/java/util/stream/Stream.java	Fri Feb 22 12:59:59 2013 -0500
+++ b/src/share/classes/java/util/stream/Stream.java	Fri Feb 22 13:17:05 2013 -0500
@@ -57,9 +57,9 @@
  * performed on a stream, it is considered <em>consumed</em> and no longer usable for other operations.
  *
  * <p>For sequential stream pipelines, all operations are performed respecting in the
- * <a href="package-summary#Ordering">encounter order</a> of the source, if the source has a defined encounter
+ * <a href="package-summary.html#Ordering">encounter order</a> of the source, if the source has a defined encounter
  * order.  For parallel stream pipelines, unless otherwise specified, intermediate stream operations preserve the
- * <a href="package-summary#Ordering">encounter order</a> of the source, and
+ * <a href="package-summary.html#Ordering">encounter order</a> of the source, and
  * terminal operations respect the encounter order of the source, if the source has an encounter order.
  *
  * @apiNote
@@ -423,7 +423,7 @@
     /**
      * Perform a <em>mutable reduction</em> operation on the elements of this stream.  A mutable reduction is one
      * in which the reduced value is a mutable value holder, such as an {@code ArrayList}, and elements are incorporated
-     * by updating the state of the result rather than replacing the result.  This is equivalent to:
+     * by updating the state of the result, rather than by replacing the result.  This is equivalent to:
      * <pre>
      *     R result = resultFactory.get();
      *     for (T element : this stream)
--- a/src/share/classes/java/util/stream/TerminalOp.java	Fri Feb 22 12:59:59 2013 -0500
+++ b/src/share/classes/java/util/stream/TerminalOp.java	Fri Feb 22 13:17:05 2013 -0500
@@ -30,7 +30,7 @@
  * has a set of <em>operation flags</em> that describes how the operation processes elements of the stream
  * (such as short-circuiting or respecting encounter order; see {@link StreamOpFlag}).
  *
- * <p>A {@code TerminalOperation} must provide a sequential and parallel implementation of the operation relative
+ * <p>A {@code TerminalOp} must provide a sequential and parallel implementation of the operation relative
  * to a given stream source and set of intermediate operations.
  *
  * @param <E_IN> The type of input elements