← Quiz: HashMap and Maps: all 10 questions
Quiz: HashMap and Maps · Question 5 of 10
Which interface lets you define MANY different sort orders outside the class?
Which interface lets you define MANY different sort orders outside the class?
- A.Comparable
- B.Comparator
- C.Iterable
- D.Serializable
Answer & explanation
Correct answer: Comparator
Comparator objects define custom orders; Comparable defines one natural order inside the class.
Can you get the rest right without peeking?
Take the timed Quiz: HashMap and Maps quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →