ArrayList print capacity

Remi Forax forax at univ-mlv.fr
Sun May 11 10:03:28 UTC 2025


Hello, 
this is not an overlook, 
the less you expose (make public), the easier it is to change the implementation in the future. 

Also, the collection API was design to avoid (if possible) to have more public methods in the implementation (ArrayList) than you have in the interface (List). 
So as a user, you can always use a List as parameter of a public method instead of an ArrayList. 

regards, 
Rémi 

> From: "임민수" <godmlzkf1 at naver.com>
> To: "core-libs-dev" <core-libs-dev at openjdk.org>
> Sent: Sunday, May 11, 2025 10:21:21 AM
> Subject: ArrayList print capacity

> Hi
> It seems that there is no code to print Capacity in ArrayList.

> Vector, a friend of ArrayList, can be printed through capacity().

> I want to add code to print Capacity of ArrayList as elementData.length.

> Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250511/8b6f009e/attachment.htm>


More information about the core-libs-dev mailing list