RFR: 8283067: Incorrect comment in java.base/share/classes/java/util/ArrayList.java
Quan Anh Mai
duke at openjdk.java.net
Sun Mar 13 02:09:47 UTC 2022
On Sat, 12 Mar 2022 09:48:14 GMT, xpbob <duke at openjdk.java.net> wrote:
> * Constructs an empty list with an initial capacity of ten
>
> =>
>
> * Constructs an empty list with default sized empty instances.
>
>
> private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};
>
> DEFAULTCAPACITY_EMPTY_ELEMENTDATA is empty and the length is 0
Yes that is the point, the backing array does not need to be allocated if there will be no element. Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7799
More information about the core-libs-dev
mailing list