Files
kotlin-fork/idea/testData/intentions/loopToCallChain/flatMap/indexUsed.kt
T
2016-08-23 22:47:42 +03:00

11 lines
392 B
Kotlin
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>for ((index, s) in list.withIndex()) {
for (line in s.lines().take(index)) {
if (line.isNotBlank()) return line
}
}
return null
}