Joshua Cranmer schrieb:
> Or you could use addAll and Collections.nCopies to implement setSize,
> and use ListIterator to do reverse iteration.
No you didn't get it. I need a fast specialized
setSize() as argued in the bug reference. According
to the collections documentation, the nCopies method
does create an extra object:
http://download.oracle.com/javase/1....lang.Object%29
... The newly allocated data object is tiny (it contains
a single reference to the data object). ...
But it is not only that this tiny object of type
Collections.CopiesList will be created. For addAll
call an Iterator AbstractList.Itr will be
created I guess, not sure.
But most likely given the abstract implementation of
addAll, the abstract way it treats its argument, and
in the particular situation that the argument is a
CopiesList.
So this is already two temporary objects on the heap.
Don't have a good feeling with this.
Bye