Java Snippet
ArrayList vs LinkedList Cheat Sheet
Difficulty: Easy
`ArrayList` and `LinkedList` both implement `List`, but their performance profiles are nearly opposite. This snippet shows the basic operations on each, the cases where `LinkedList` actually wins (head/tail mutation via the `Deque` API), and a quick benchmark that demonstrates random access cost. The takeaway: default to `ArrayList`; only reach for `LinkedList` when you genuinely need queue or deque behaviour.
