Java Interview Question

What is the difference between ArrayList and LinkedList?

Updated 2026-07-10 · Beginner friendly
Quick answer

ArrayList is backed by a resizable array, so it gives fast access by index in O(1) but is slow to insert or remove in the middle because elements shift. LinkedList is backed by nodes with pointers, so it is fast to insert or remove at the ends but slow to access by index. Use ArrayList for mostly reading by index and LinkedList for frequent inserts and removals.

The underlying difference

ArrayList stores elements in a continuous array, which is why indexing is instant. LinkedList stores each element in a node that points to the next, which is why walking to an index takes time but linking a new node is cheap.

Quick comparison

In the interview

Say ArrayList for read heavy work and LinkedList for insert heavy work, then add that in practice ArrayList is the sensible default because random access is common and it is cache friendly. That practical note lands well.

Want the full Java guide?

Read every Java concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the Java guide All Java questions