ArrayList vs LinkedList in Java — Performance and When to Use Each
ArrayList offers fast random access backed by an array; LinkedList offers fast insertion/removal at the ends backed by nodes. Learn the real tradeoffs.
Published September 22, 2026
ArrayList stores items in an array, giving fast index access; LinkedList stores nodes with pointers, giving fast insertion at the ends. In practice ArrayList is the better default almost every time.
The concept
ArrayList.get(i) is O(1), appends are amortised O(1), and inserting in the middle shifts elements (O(n)). It is cache friendly because elements are contiguous.
LinkedList add/remove at a known node is O(1), but finding the node is O(n), and each element costs extra memory for two pointers.
Big-O comparison
Practical examples
Default choice
List<String> names = new ArrayList<>();
names.add("Ada");
names.get(0);Queue or deque use
Deque<Integer> q = new ArrayDeque<>(); // faster than LinkedList
q.addLast(1); q.pollFirst();Presize to avoid resizing
List<Integer> big = new ArrayList<>(100_000);Common mistakes
- Using LinkedList.get(i) in a loop (quadratic).
- Believing linked lists are faster for insertion without counting the search.
- Using LinkedList as a queue when ArrayDeque is better.
Key takeaways
- Default to ArrayList.
- LinkedList wins rarely, mostly via iterators.
- ArrayDeque for queues and stacks.
FAQ
Is LinkedList thread-safe?
No, neither is; wrap with Collections.synchronizedList or use concurrent collections.
How does ArrayList grow?
It allocates a larger array (about 1.5×) and copies when full.