Skip to content

Glossary: Data Structures and Algorithms in Java

thenComparing

Also written: reversed, reverseOrder

Comparator helpers: `thenComparing` adds a tie-breaker used only when the first comparison is equal, `reversed()` flips a comparator, and `Comparator.reverseOrder()` gives the opposite of natural order.

Where the book teaches it

Related terms

comparatormax-heap