Most modern mainstream programming languages include some way to implement an arraylist-type structure
Like any array, arraylists are bolstered up in the ranks of data structures by their random access property (sometimes also called direct access) which allows elements to be accessed in O(1) (constant) time. This gives them the edge over linked lists, etc. for getting and overwriting elements, but adding/removing elements from anywhere but the end of the array requires shuffling the remaining elements to compensate in O(n) (linear) time (whereas a linked list will do it in constant time) so the choice must depend on the intended application.
Common operations on arraylists include:
- sorting (they are compatible with quicksort, mergesort, bubblesort and many others)
- appending elements
- 'popping' elements off the end
- adding/removing elements from somewhere other than the end
- iterating through elements to change/check a property
- replacing data at a particular index
- clearing the arraylist
- copying the arraylist
- finding the size of the arraylist
- checking if the arraylist is empty
There are times when a programmer can be sure they will never need more than a certain number of elements in their array, but for all the other times, arraylists are highly useful structures.