[concurrency-interest] CopyOnWriteArrayNavigableSet too late for JEP 266?

Doug Lea dl at cs.oswego.edu
Wed Oct 14 08:41:57 EDT 2015

On 10/13/2015 12:52 AM, Mike Duigou wrote:
> The main difference between this new implementation and the existing
> CopyOnWriteArraySet is that the new implementation keeps the backing array in
> sorted order and can use binary search for some operations.
> ...
> Is it likely too late to consider this for inclusion in JEP 266? What's the best
> way to contribute it for inclusion in the JSR-166 CVS (assuming there is interest)?

There are a couple of senses of the "too late" question here:

Backing up (about 18 years!): SortedArray{List,Set} (non-concurrent)
were considered for initial inclusion in Collections. My vague
recollection is that they were triaged out because the combination of
sort and binarySearch on arrays and lists covered most use cases
(including for example: creating, adding a bunch of items, sorting,
then using binary search thereafter).

Not all use cases though. The missing ones are the same as those
{Sorted,Navigable}CopyOnWriteArray{List,Set} would address.
(Even though "Navigable" replaced "Sorted" interface, class names
can still use the friendlier term.) All of these might be good
choices for collections with approximately 10 < size < 100 and/or
with very low insertion rates after initial construction.

So, one question is whether all four of SortedArrayList, SortedArraySet,
SortedCopyOnWriteArrayList, and SortedCopyOnWriteArraySet should now be
introduced to fill in the coverage gaps. Or whether the use cases
covered by only SortedCopyOnWriteArraySet are special enough to
warrant inclusion without the others. This is the kind of question
that tends to lead to prolonged inaction in JDK. So any thoughts on
resolving it quickly would be welcome.


I'm not sure about prospects for jdk9.

More information about the Concurrency-interest mailing list