Question 8
Back to Exercise
Since Java 8, what happens when a single HashMap bucket holds more than 8 entries (and the table is large enough)?
- A The map throws an exception
- B The bucket is converted to a red-black tree Correct
- C The extra entries are dropped
- D The load factor changes
Correct Answer: Option B
That bounds lookups in that bucket to O(log n).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!