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

10 lines
327 B
Kotlin
Vendored

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