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