Reports if statements and ternary expressions with Comparator.compare() calls that can be replaced with Comparator.max() or Comparator.min() calls.

Example:


Comparator<String> comp = Comparator.naturalOrder();
String result = comp.compare(a, b) > 0 ? a : b;

After the quick-fix is applied:


Comparator<String> comp = Comparator.naturalOrder();
String result = comp.max(a, b);

New in 2026.1