Possible Duplicate:
When to use LinkedList<> over ArrayList<>?
This is a genuine attempt to know when would one use a LinkedList;
From what i understand since the java.util.LinkedList doesn’t support random access, the only way to get the nth element is to skip from 1 to (n-1) or use get(n) which itself is very inefficient.
So why would one use a LinkedList? An ArrayList would serve for most part unless you want to iterate the collection from both sides using a ListIterator?
Think about this method:
For large lists,
LinkedListwill heavily out-performArrayList. The same applies for… and many other methods. For more information, I suggest reading about the
java.util.Dequeinterface, which is also implemented byLinkedList