Table 2


List classes and interfaces.

List (interface) Order is the most important feature of a List; it promises to maintain elements in a particular sequence. List adds a number of methods to collection that allow insertion and removal of elements in the middle of a List. (This is recommended only for a LinkedList.) A List will produce a ListIterator, and using this you can traverse the List in both directions, as well as insert and remove elements in the middle of the list (again, recommended only for a LinkedList).
ArrayList A List backed by an array. Use instead of Vector as a general-purpose object holder. Allows rapid random access to elements, but is slow when inserting and removing elemnts from the middle of a list. ListIterator should be used only for back-and-forth traversal of an ArrayList, not for inserting and removing elements.
LinkedList Provides optional sequential access, with inexpensive insertions and deletions from the middle of the list. Relatively slow for random access. (Use ArrayList instead.) Also has addFirst(), addLast(), getFirst(), getLast(), removeFirst(), and removeLast() (which are not defined in any interfaces or base classes) to allow it to be used as a stack, a queue, and a dequeue.