Back to Intellij Community

VerboseNullabilityAndEmptiness

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/VerboseNullabilityAndEmptiness.html

2025.3-rc-2597 B
Original Source

Reports combination of null and emptiness checks that can be simplified into a single check.

The quick-fix replaces highlighted checks with a combined check call, such as isNullOrEmpty().

Example:

fun test(list: List<Int>?) {
      if (list == null || list.isEmpty()) {
          println("List is empty!")
      } else {
          println(list.joinToString())
      }
  }

After the quick-fix is applied:

fun test(list: List<Int>?) {
      if (list.isNullOrEmpty()) {
          println("List is empty!")
      } else {
          println(list.joinToString())
      }
  }