You're confusing two things in the ArrayList
, size and capacity. Size is how many elements are in your ArrayList
, and since you never add anything to your ArrayList
, 0
is the perfectly correct result. Capacity is just the initial capacity of the underlying array and is only relevant for performance purposes.
For more information you should see the JavaDoc: ArrayList