Inspectopedia
 
2024.3

'if' condition can be replaced with lambda call

Info
New
Last modified: 03 December 2024

Reports isEmpty, isBlank, isNotEmpty, or isNotBlank calls in an if statement to assign a default value.

The quick-fix replaces the if condition with ifEmpty or ifBlank calls.

Example:

After the quick-fix is applied:

This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.