An ArrayList can be traversed using either iterators or indexes.
Tutorial Details:
java.util.ArrayList allows for expandable arrays, and is the Collections replacement for the older Vector class. An ArrayList has the following advantages over an array:
An ArrayList automatically expands as data is added.
Access to any element of an ArrayList is O(1). Insertions and deletions are O(N).
An ArrayList has methods for inserting, deleting, and searching.
An ArrayList can be traversed using either iterators or indexes.
Automatic expansion. Use ArrayList when there will be a large variation in the amount of data that you would put into an array. Arrays should be used only when there is a constant amount of data. For example, storing information about the days of the week should use an array because the number of days in a week is constant. Use an array list for your email contact list because there is no upper bound on the number of contacts.
Rate Tutorial: http://www.roseindia.net/java/java-tips/data/collections_non_generic/20lists/20arraylist.shtml
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: ArrayList (non-generic)
View Tutorial: ArrayList (non-generic)
Related
Tutorials:
|