ArrayList vs ArrayDeque vs LinkedList: which one is best?

It depends what you're doing. Each one has advantages and disadvantages.

Accessing an element by index

Runtime per push operation

Insertion/deletion by index


A LinkedList uses more space per element because it has 2 pointers per node.
However, an ArrayList or ArrayDeque may have unused elements (if the capacity is larger than the size).


Sometimes it is difficult to predict which one is best without testing, but here are a few tips: