--- /dev/null 2013-02-14 00:07:37.184020992 -0500 +++ new/src/share/classes/java/util/stream/StatefulOp.java 2013-02-21 14:11:07.000000000 -0500 @@ -0,0 +1,44 @@ +package java.util.stream; + +/** + * A stateful intermediate stream operation ({@link IntermediateOp}). Stateful means that state + * is accumulated as elements are processed. Examples of stateful operations are sorting, extracting a subsequence + * of the input, or removing duplicates. Statefulness has an effect on how the operation can be parallelized. + * Stateless operations parallelize trivially because they are homomorphisms under concatenation: + * + *
+ * statelessOp(a || b) = statelessOp(a) || statelessOp(b) + *+ * + * 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 #evaluateParallel(PipelineHelper)}). + * + * @param