[concurrency-interest] COWList snapshot.

Martin Buchholz martinrb at google.com
Wed Feb 19 15:22:07 EST 2014


On Wed, Feb 19, 2014 at 12:08 PM, Zhong Yu <zhong.j.yu at gmail.com> wrote:

> On Wed, Feb 19, 2014 at 1:55 PM, Martin Buchholz <martinrb at google.com>
> wrote:
> > Владимир,
> >
> > I agree that a snapshot method as you propose would be useful.  As
> always,
> > implementing the List interface ends up being rather a lot of tedious
> work,
> > which may be a reason it never got done.
>
> Interestingly, JDK doesn't not seem to have a method to wrap an array
> as a read-only list. A lot of people use Arrays.asList(), which is
> wrong...
>

It's probably a matter of trust.  If you implemented ImmutableArrayList
with a constructor that took an Object[], you would need to trust whoever
handed you the array, or make a copy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140219/6a9694ef/attachment.html>


More information about the Concurrency-interest mailing list