Inspectopedia Help

Boolean expression could be replaced with conditional expression

Reports any boolean expressions which can be formulated in a more compact and, arguably, clear way than by using a conditional expression.

Use the quick-fix to replace the boolean expression by a conditional expression.

Example:

a && b || !a && c;

After the quick-fix is applied:

a ? b : c;

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023