Array length | SoloLearn: Learn to code for FREE!

0

Array length

Is there a way to make an array that just adds/subtracts from its length whenever a number is added/removed?

10/25/2016 5:18:13 PM

Greg M

1 Answer

New Answer

+2

In java, there is ArrayList which does exactly what you want. They are created with initial size, but when this size is exceeded, the collection is automatically enlarged. When objects are removed, the ArrayList may shrink in size.