Files
kotlin-fork/idea/testData/intentions/loopToCallChain/firstOrNull/ifAssign_preserveComments.kt.after
T

11 lines
314 B
Plaintext
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'firstOrNull{}'"
// IS_APPLICABLE_2: false
fun foo(list: List<String>) {
// string should be non-empty
// save it into result
val result: String? = list.firstOrNull {
// search for first non-empty string in the list
it.length > 0
}
}