ArrayList.subList
Doug Lea
dl at cs.oswego.edu
Fri Jul 29 10:34:07 UTC 2011
On 07/28/11 19:20, Doug Lea wrote:
> Thanks. I hadn't noticed that the parenthesized "i.e., this list"
> in the List specs
> (http://download.oracle.com/javase/7/docs/api/java/util/List.html#subList%28int,%20int%29
> -- pasted below)
> overly constrains the interpretation of "backing list",
> which would otherwise naturally refer to the ArrayList. This
> would be challenging to fix in ArrayList while retaining
> compatibility, even though it is sensibly ignored in
> other List implementations.
As a bandaid, a faster but still compatible path for
simple get/set operations on ArrayList.subList could be
put in at the expense of adding a a few extra fields.
This would remove the main problem here. Mike: do you
want to try this? If not, I'll send something.
(BTW, similar wording is similarly ignored in JDK
{Sorted,Navigable}Map.subMap implementations; i.e.,
TreeMap and ConcurrentSkipListMap).
-Doug
More information about the core-libs-dev
mailing list