|
If the data structure needs to grow, then you should not use arrays because arrays are defined to have size. To make an array grow, you need to redefine it and copy previous data to the new one which is cpu consuming.
You can use Vector or ArrayList! Vectors/ArrayLists can grow when necessary automatically.. You will just need to call their add methods to add a new item.
|