How to Use a Java ArrayList


A Java ArrayList is a general-purpose resizeable array. It provides most of the facilities generally expected of arrays in other languages. These include: accessing elements using an index, adding, removing and updating elements, dynamic re-sizing, iterating over the elements, etc. Most of these operations have been specially tweaked for general purpose usage. There are a few other types of “arrays” (classes that implement the List interface, to be technical) which are intended for special purposes. These include: LinkedList supports fast insertion and removal at intermediate indices. Vector is similar to an ArrayList but is synchronized and is suitable in place…

Read the full article: How to Use a Java ArrayList