On Fri, 20 Feb 2026 13:07:43 GMT, Jaikiran Pai <[email protected]> wrote:

> The `ArrayDeque()` constructor takes the number of "elements" whereas 
> `ArrayList()` constructor takes the initial capacity. 

They both seem to allocate Object arrays to fit elements. ArrayList makes an 
array for 8 objects, ArrayDeque 8 + 1.

> Having said that, I can't see why this `8` was used in the first place. 


> If we are going to change this to an ArrayList, maybe we should just change 
> this to new ArrayList<>().

Sounds reasonable, that would allow `isEmpty()` checks on an empty list to 
avoid allocation. If that matters.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29432#discussion_r2833180523

Reply via email to