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

13 lines
401 B
Kotlin
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'filter{}.mapTo(){}'"
// INTENTION_TEXT_2: "Replace with 'asSequence().filter{}.mapTo(){}'"
fun foo(list: List<String>): List<Int> {
val target = createCollection()
<caret>for (s in list) {
if (s.length > 0)
target.add(s.hashCode())
}
return target
}
fun createCollection(): MutableList<Int> = java.util.ArrayList()