RFR: 8266571: Sequenced Collections [v2]
Stuart Marks
smarks at openjdk.org
Sat Apr 15 03:35:50 UTC 2023
On Sat, 25 Mar 2023 07:09:43 GMT, Rémi Forax <forax at openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - More specification tweaks.
>> - Add simple overrides to ArrayList.
>
> src/java.base/share/classes/java/util/ArrayList.java line 573:
>
>> 571: } else {
>> 572: Object[] es = elementData;
>> 573: sz--;
>
> This line and the following two lines can be understood as the field size being updated which is not the case.
> I think it's more readable to use
>
> @SuppressWarnings("unchecked") E oldValue = (E) es[sz - 1];
> fastRemove(es, sz - 1);
>
> The JIT will common the subexpression 'sz - 1' at runtime.
Renamed the variable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1167366493
More information about the core-libs-dev
mailing list