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
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo(list: List<String>): List<String> {
val target = createCollection()
<caret>list.flatMapTo(target) { it.lines() }
return target
}
fun createCollection() = java.util.ArrayList<String>()