posted 17 years ago
An ArrayList has very fast access to its elements, but is slower for adding and deleting elements; the farther from the end, the slower it is.
A LinkedList is very fast if you need to add or delete near the start / end a lot, but for adding, deleting and retrieving from the middle it is also quite slow (unless you are using a ListIterator).
This is because, to find an element of the LinkedList, it first has to traverse to that element. Fortunately, it will choose the shortest path (either from the start or from the end), but if you want to insert, delete or retrieve near the middle, it will have to traverse half of the list before it finally arrives at that point.
Now I mentioned the ListIterator. This interface has methods to add, remove or set elements to the current position. Since this position is cached, there is no need to traverse the list anymore.