RFR: 8283067: Incorrect comment in java.base/share/classes/java/util/ArrayList.java

liach duke at openjdk.java.net
Sun Mar 13 03:14:42 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

This observation should probably be put in an implementation note, that the allocation of the backing array only happens when any element is added. Also, this API documentation change requires a CSR review.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7799


More information about the core-libs-dev mailing list