Negated call can be simplified
Reports negation isEmpty()
and isNotEmpty()
for collections and String
, or isBlank()
and isNotBlank()
for String
.
Using corresponding functions makes your code simpler.
The quick-fix replaces the negation call with the corresponding call from the Standard Library.
Example:
fun main() {
val list = listOf(1,2,3)
if (!list.isEmpty()) {
// do smth
}
}
After the quick-fix is applied:
fun main() {
val list = listOf(1,2,3)
if (list.isNotEmpty()) {
// do smth
}
}
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023