Skip to main content

Quick quiz

Read the question, answer in your head, flip the card, and mark whether you knew it.

Card 1 / 33Java
Question

A HashMap bucket reaches 8 entries. What happens?

Think of your answer, then click or press Space
Answer

It treeifies into a red-black tree, but only if the table has at least 64 buckets; otherwise the map resizes instead. The bin turns back into a list at 6 entries. Lookup in a degenerate bucket drops from O(n) to O(log n).

Read the full explanation →