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

9 lines
379 B
Kotlin
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexedNotNull{}.mapTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexedNotNull{}.mapTo(){}'"
fun foo(list: List<String?>, target: MutableList<String>) {
<caret>for ((index, s) in list.withIndex()) {
val length = s?.substring(index)?.length ?: continue
target.add(length.toString())
}
}