Hi Paul,

> > I'm mildly opposed to this change - I added comments to the bug.
> >
>
> It looks like you are not the only one. I am outnumbered :-)
>
> The behaviour of ArrayList.remove, and also ArrayList.removeRange, are
> outliers [*]. It?s also a rather obscure difference behaviour with likely
> minimal impact if changed (far less so than the change to Arrays.toList) .
>

There are other outliers too,
add and Add all use a dedicated range check method (rangeCheckForAdd) which
validates the argument > 0.

Imho, the the rangeCheck method is incorrectly used in remove(int), because
it says it is intended to be used immediately before the array access.

I personally would vote to inline the rangeCheck methods and do the
appropriate check in the former caller. as it turns out for every method a
slightly different check would make most sense

Fabian

Reply via email to