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

9 lines
375 B
Plaintext
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.flatMap{}.firstOrNull{}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.flatMap{}.firstOrNull{}'"
fun foo(list: List<String>): String? {
<caret>return list
.mapIndexed { index, s -> s.lines().take(index) }
.flatMap { it }
.firstOrNull { it.isNotBlank() }
}