RFR [8014066] Mistake in documentation of ArrayList#removeRange
Martin Buchholz
martinrb at google.com
Wed Mar 19 22:32:41 UTC 2014
No one is as performance obsessed as Ulf. In this case, because it's
specified to throw, and because it's a bulk operation, let's try hard not
to care about the wasted nanoseconds.
On Wed, Mar 19, 2014 at 3:02 PM, Ulf Zibis <Ulf.Zibis at cosoco.de> wrote:
> Am 19.03.2014 09:19, schrieb Ivan Gerasimov:
>
> Thank you Ulf!
>>
>> On 19.03.2014 2:12, Ulf Zibis wrote:
>>
>>> Am 18.03.2014 19:28, schrieb Ivan Gerasimov:
>>>
>>>>
>>>> Assuming this last iteration is OK, should the next step be a CCC
>>>> request?
>>>>
>>>
>>> Do you mean? :
>>> /*
>>> * ...
>>> + * It is assumed that fromIndex <= toIndex, otherwise the behaviour
>>> of this method is undefined.
>>> * ...
>>> - * toIndex < fromIndex})
>>> * ...
>>> */
>>> protected void removeRange(int fromIndex, int toIndex) {
>>> ...
>>>
>>>
>> The (fromIndex > toIndex) condition is checked now, so the behavior of
>> the method is defined - it throws an exception.
>>
>
> Because Martin stated some days ago, that it normally should not occur,
> that removeRange is invoked with toIndex < fromIndex, and checking this
> again unnecessarily decreases performance a little, I was hoping, your
> "next CCC step" would be to drop this check.
>
> -Ulf
>
>
More information about the core-libs-dev
mailing list