Reports cases where the minimum or the maximum of two numbers can be calculated using a Math.max() or Math.min() call instead of doing it manually.

Example:


  public int min(int a, int b) {
    return b < a ? b : a;
  }

After the quick-fix is applied:


  public int min(int a, int b) {
    return Math.min(a, b);
  }

Use the Disable for float and double option to disable this inspection for double and float. This is useful because the quick-fix may slightly break semantics for float/ double when handling NaN. Nevertheless, in most cases it will actually fix the subtle bug when users do not care about NaN.

New in 2019.2