ArrayList and LinkedList
Two List implementations with different performance trade-offs.
Easy
| Operation | ArrayList | LinkedList |
|---|---|---|
| Get by index | ||
| Add at end | amortised | |
| Insert/remove in middle | once positioned | |
| Memory | compact | extra node objects |
ArrayList is the right default almost always. For queues use ArrayDeque.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.