RFR 8024405: Spliterators.spliterator should support CONCURRENT characteristic

Martin Buchholz martinrb at google.com
Mon Sep 16 18:27:42 UTC 2013

delete "the" typo

+     * @param characteristics Characteristics of the this spliterator's source

A top-level Spliterator should not report CONCURRENT and SIZED
A top-level Spliterator should not report both CONCURRENT and SIZED

I think the docs for SIZED can make it clearer that it is an error for the
size to change while the spliterator is in progress.  One can imagine
CONCURRENT data structures whose SIZE does not change.  An iterator over an
to mind.*

static final int SIZED

Characteristic value signifying that the value returned from
estimateSize() prior
to traversal or splitting represents a finite size that, in the absence of
structural source modification, represents an exact count of the number of
elements that would be encountered by a complete traversal.

On Sun, Sep 15, 2013 at 9:03 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

> Hi,
> http://cr.openjdk.java.net/~psandoz/tl/JDK-8024405-spliterators-size-concurrent/webrev/
> This fixes an oversight in creating spliterators from the iterator of a
> collection or directly from an iterator (+ primitive variants).
> If CONCURRENT is supplied as a characteristic then the returned
> spliterator should not report SIZED/SUBSIZED.
> This could have resulted in an issue with ArrayBlockingQueue since it's
> spliterator is created from a weakly consistently iterator and thus exact
> size is not known.
> A CCC is required.
> Paul.

More information about the core-libs-dev mailing list