Map Buckets
Medium · Phone screen · Full-time
They asked me to explain how HashMap works internally in Java, starting from what happens when you call put(). I walked through how the key gets hashed, which bucket it maps to, and how collisions are handled with chaining. The part that got interesting was when they asked what happens in Java 8 when a bucket gets too many entries, and I had to explain the linked list to red-black tree conversion at the treeify threshold. They also threw a curveball asking what would happen if I used a mutable Employee object as a key without overriding equals and hashCode. I explained that the map would silently break because the hash could change after insertion, making the key unfindable. That follow-up is what made the question feel harder than a typical collections quiz.
