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

10 lines
288 B
Kotlin
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.mapIndexed{}.firstOrNull{}'"
fun foo(list: List<String>): Int? {
<caret>for ((index, s) in list.withIndex()) {
val x = s.length * index
val y = x + index
if (y > 0) return y
}
return null
}