Back to Intellij Community

RedundantComparatorComparing

java/java-impl/resources/inspectionDescriptions/RedundantComparatorComparing.html

2025.3-rc-2400 B
Original Source

Reports Comparator combinator constructs that can be simplified.

Example:

c.thenComparing(Comparator.comparing(function));

  Comparator.comparing(Map.Entry::getKey);

  Collections.max(list, Comparator.reverseOrder());

After the quick-fixes are applied:

c.thenComparing(function)

  Map.Entry.comparingByKey()

  Collections.min(list, Comparator.naturalOrder());

New in 2018.1