Inspectopedia Help

Can be replaced with binary operator

Reports function calls that can be replaced with binary operators, in particular comparison-related ones.

Example:

fun test(): Boolean { return 2.compareTo(1) > 0 // replaceable 'compareTo()' }

After the quick-fix is applied:

fun test(): Boolean { return 2 > 1 }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023