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

9 lines
303 B
Kotlin
Vendored

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