Sometimes shorter code with filterTo, mapTo and flatMapTo

This commit is contained in:
Valentin Kipyatkov
2016-04-19 19:59:23 +03:00
parent 744186402d
commit 49f2c5f657
15 changed files with 221 additions and 13 deletions
+11
View File
@@ -0,0 +1,11 @@
// WITH_RUNTIME
import java.util.ArrayList
fun foo(list: List<String>): List<Int> {
val target = ArrayList<Int>(100)
<caret>for (s in list) {
if (s.length > 0)
target.add(s.hashCode())
}
return target
}