RFR: 8266571: Sequenced Collections [v2]
Rémi Forax
forax at openjdk.org
Sat Mar 25 07:13:38 UTC 2023
On Sat, 25 Mar 2023 03:54:23 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> PR for Sequenced Collections implementation.
>
> 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.
src/java.base/share/classes/java/util/Collections.java line 1173:
> 1171: * @serial include
> 1172: */
> 1173: static class UnmodifiableSequencedCollection<E> extends UnmodifiableCollection<E>
`private` is missing
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1148319735
PR Review Comment: https://git.openjdk.org/jdk/pull/7387#discussion_r1148319899
More information about the core-libs-dev
mailing list