When to use ArrayList or LinkedList?
|1 Adding new elements is pretty slower than.
||1 Adding new elements is pretty fast for either type of
|2 ArrayList, doing random lookup using "get" is fast.
||2 LinkedList, doing random lookup using "get" is slow.
|3 The removing elements, using ArrayList is slow.
||3 removing elements, using LinkedList is fast.
|4 This is because all remaining elements in the underlying
array of Object instances must be shifted down for each remove operation.
||4 It's slow because there's no efficient way to index into
the middle of a linked list.
|5 best for cases where you're doing random access on the
||5 deletion can be done simply by changing a couple of links.
Read More →
||6 A LinkedList works better if you're doing a lot of editing
in the middle of the list.