JDK java.util.concurrent.ConcurrentSkipListSet.equals(Object o) implementation efficiency

Doug Lea dl at cs.oswego.edu
Fri May 26 18:11:31 UTC 2017


On 05/26/2017 12:51 PM, Jason Mehrens wrote:

> So it should be safe to do an ordered  'list' type element comparison
> if and only if you have determined that both sets/maps use the same
> ordering. In your example code you are missing the check to make sure
> the comparators are both null or equal.

Yes; this check must be added.

> 
> Seems like a worthwhile RFE.  In general, though I tend to think of
> use cases for ConcurrentSkipListSet as "wildly mutating" which means
> you never call Set equals or equals fails pretty early due to the
> mutation.
> 

However, this technique might apply more usefully to TreeSet.

-Doug



More information about the core-libs-dev mailing list