[concurrency-interest] Should CopyOnWriteArrayList implement RandomAccess?
yankee.sierra at gmail.com
Thu Jun 27 10:51:02 EDT 2013
On Thu, Jun 27, 2013 at 3:37 AM, Gustav Åkesson
<gustav.r.akesson at gmail.com>wrote:
> Because if it would have been removed it would also break people's code
> (e.g. those assigning a COWAL instance to a RandomAccess type).
This seems like over-sensitivity to backwards compatibility. There are no
methods on RandomAccess, so I don't know why you would take a List of known
type and cast it to RandomAccess (e.g. RandomAccess r = new COWAL()). In
fact, I don't know why you would do *anything* with RandomAccess other than
checking for it with instanceof; I suspect that if it had come into being
in 1.5, it would have been an annotation instead of an interface.
In the unlikely event that anyone actually assigns an instance to
RandomAccess without first checking instanceof, I think it'd be valid to
tell them to use Object instead.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest