Files
kotlin-fork/idea/testData/intentions/loopToCallChain/flatMap/indexUsed.kt.after
T
2016-08-23 22:47:42 +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() }
}