Question 6
Back to Exercise
What must a class used as a HashMap key implement correctly?
- A Comparable
- B equals and hashCode Correct
- C Serializable
- D Cloneable
Correct Answer: Option B
TreeMap needs Comparable or a Comparator instead.
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!