default random access list spliterator

Paul Sandoz paul.sandoz at
Mon Mar 7 12:59:11 UTC 2016

> On 7 Mar 2016, at 12:47, Peter Levart <peter.levart at> wrote:
> What about a Spliterator based on List.subList() method? While the specification of List.subList() does not guarantee any specific behavior when underlying list is structurally modified, the implementations (at least implementations in JDK based on AbstractList) do have a fail-fast behavior and there's a chance other implementations too.

We currently have as the @implSpec:

* @implSpec
* The default implementation creates a
* <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
* from the list's {@code Iterator}.  The spliterator inherits the
* <em>fail-fast</em> properties of the list's iterator.

Note the inheritance clause, which also covers the sublist case.

We would need to update with something like:

"If this list implements RandomAccess then…. and the spliterator is late-binding, and fail-fast
on a best effort basis if it is detected that this list (or any backing list if this list is a sub-list) has
been structurally modified when traversing due to an change in size as returned by the size()


More information about the core-libs-dev mailing list