posted 14 years ago
It depends how you loop through it.
First, ArrayList is using arrays which are index-based, so it's complexity for obtaining objects is always 1.
LinkedList is implemented using chain of connected elements. So if you want to obtain element 500, it has to traverse from element 1 to 500 (complexity is n). That is why ArrayList ist faster for obtaining objects than LinkedList.
Now, if you use the ListIterator, LinkedList might keep track of what the next element is and therefore be just as fast, not sure though.
JDBCSupport - An easy to use, light-weight JDBC framework -