What changed in Java 8
Java 8LTS6 changes across 4 questions — each with the behaviour it replaced, because “and how did it work before?” is the follow-up.
How does HashMap work internally?
A collision bin converts from a linked list to a red-black tree once it holds 8 nodes AND the table is at least 64 slots, capping worst-case lookup at O(log n).
Before: A bin was always a linked list, so keys with a colliding hashCode() degraded lookup to O(n) with no ceiling — the shape behind the 2011 hash-collision denial-of-service disclosures.
Resize splits each bin into a lo/hi pair with the single bit test (e.hash & oldCap) == 0, preserving relative order and rehashing nothing.
Before (now gone): transfer() recomputed each index and prepended, reversing every chain. Two threads resizing at once could weave a circular list, and a later get() would then spin at 100% CPU forever.
Hash spreading reduced to one operation: h ^ (h >>> 16).
Before (now gone): Java 7 applied four shifts and XORs, plus an optional hashSeed and a separate string-hashing path, to defend against weak hashCode() distributions.
When would you use LinkedList instead of ArrayList?
Collection.removeIf() removes in one pass with the right complexity for the implementation.
Before: Removing matching elements meant an explicit Iterator with it.remove(), and doing it with an index loop over an ArrayList was quietly O(n^2) — or a ConcurrentModificationException if you used a for-each.
Why is String immutable, and what is the string pool?
PermGen removed outright, replaced by Metaspace, which grows into native memory.
Before (now gone): -XX:MaxPermSize was a tuning parameter every Java web application eventually had to learn.
What is the difference between checked and unchecked exceptions?
Lambdas made checked exceptions structurally unusable: no built-in functional interface declares throws, so a checked exception cannot escape a lambda body.
Before: Anonymous inner classes had the same constraint, but nobody wrote enough of them to care. Streams put this in front of every Java developer at once, and it is why new APIs stopped using checked exceptions.