Supported case when result variable initialization is not right before the loop

This commit is contained in:
Valentin Kipyatkov
2016-04-21 17:40:25 +03:00
parent 9b69c5c375
commit 27063bcd9b
11 changed files with 170 additions and 10 deletions
@@ -0,0 +1,15 @@
// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filterIndexed{}.map{}'"
import java.util.*
fun foo(list: List<String>): List<Int> {
val result = ArrayList<Int>()
var i = 0
<caret>for (s in list) {
if (s.length > i) {
result.add(s.length)
}
i++
}
return result
}