RFR 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
Paul Sandoz
paul.sandoz at oracle.com
Sun Sep 15 16:20:53 UTC 2013
Hi,
http://cr.openjdk.java.net/~psandoz/tl/JDK-8024408-split-col-size/webrev/
It is necessary to relax the constraints when SIZED should be reported for a Spliterator of a Collection or Set.
The spliterator of a Collection/Set can report SIZED, or CONCURRENT, or neither (and never both). The latter case can occur with the strange beast known as WeakHashMap, which is not CONCURRENT in the commonly understood sense, but it's traversal is weakly consistent and the size is only an estimate.
Note that no change was made to List, which basically means no List implementation can be concurrent. This interface is not well suited for concurrent implementations given the determinism expected for indexed access e.g. l.get(l.size() - 1) could barf for a concurrent or weak list if something is concurrently removed.
A CCC is required.
Paul.
More information about the core-libs-dev
mailing list