LearnFrenzy
Sign in Take a free test

Records, Enums and Sealed Classes · Records, Enums and Sealed Classes MCQ · Question 7

Why use EnumMap Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

What is an advantage of EnumMap over HashMap for enum keys?

  • A It allows null keys
  • B It is array-backed, faster, more compact and iterates in declaration order Correct
  • C It is thread-safe
  • D It sorts by value
Correct Answer: Option B

EnumSet similarly uses a bit vector.

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