RFR [8014066] Mistake in documentation of ArrayList#removeRange
Martin Buchholz
martinrb at google.com
Fri Mar 14 06:38:05 UTC 2014
On Thu, Mar 13, 2014 at 3:59 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 03/13/2014 12:34 PM, Martin Buchholz wrote:
>
>> I notice there are zero jtreg tests for removeRange. That should be
>> fixed.
>>
>> I notice there is a removeRange in CopyOnWriteArrayList, but it is
>> package-private instead of "protected", which seems like an oversight.
>> Can Doug
>> remember any history on that?
>>
>
> CopyOnWriteArrayList does not extend AbstractList, but its
> sublist does. The sublist relies on COWAL.removeRange only for clear.
> So COWAL sublist clearing uses the same idea as
> AbstractList, and gives it the same name, but it is not the
> same AbstractList method, so need not be protected.
>
Ahh OK, I think the party line for *users* is if they want to remove a
range of elements from a list, use list.subList(fromIndex, toIndex).clear
(), so there's no advantage in making COWAL.removeRange a public interface.
More information about the core-libs-dev
mailing list