Machine-translated by Google. Questions are authored in English.
Top

Discussion

What a Comparator's reversed method produces - which of the following is true?

  • A.A comparator that compares the operands in the opposite argument order but the same result.
  • B.A comparator that sorts nulls first instead of last.
  • C.A comparator imposing the opposite order of the original.
  • D.A comparator that reverses the collection it is applied to.

Answer: C

It returns a new comparator whose result is the negation of the original's, so descending order needs no separate implementation. thenComparing composes in the other dimension, breaking ties with a second key rather than flipping the first.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.