+ 2
Why the need for arrayList when there's Array to handle things in Java?
Array not enough
2 Réponses
+ 7
Simply stating,
1) Removing an element from an array is hard and needs a loop. But, just 'remove()' function can be used to remove an element from an arraylist.
2) Adding an element to an array is hard and needs a loop. But, just 'add()' function can be used to add an element to an arraylist.
Arraylists are advantageous because they can be dynamically changed very easily.
+ 3
Array list is more flexible than a normal Array, so if you have multiple items that you need to store in an array that needs to change over time too then an Array list can be great for you.