LearnFrenzy
Sign in Take a free test

HashMap and TreeMap · HashMap and TreeMap MCQ · Question 8

What happens to a crowded bucket Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links