🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Comparable vs Comparator: all 10 questions

Quiz: Comparable vs Comparator · Question 9 of 10

Which statement about List.sort is true?

Which statement about List.sort is true?

  1. A.It may change the order of elements that compare equal
  2. B.It is stable: equal elements keep their original relative order
  3. C.It only works on arrays
  4. D.It ignores the comparator for Strings
Answer & explanation

Correct answer: It is stable: equal elements keep their original relative order

Java's object sort (TimSort) is stable, which is why sorting in stages works.

Can you get the rest right without peeking?

Take the timed Quiz: Comparable vs Comparator quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →