Files
kotlin-fork/idea/testData/intentions/loopToCallChain/firstOrNull_ifAssign_preserveComments.kt.after
T
2016-08-16 17:38:03 +03:00

8 lines
282 B
Plaintext
Vendored

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