Add flatMap sample KT-20357

This commit is contained in:
Dmitry Borodin
2019-08-09 21:11:58 +02:00
committed by Ilya Gorbunov
parent 29b25e3901
commit 664d69b752
8 changed files with 41 additions and 0 deletions
@@ -502,6 +502,12 @@ class Collections {
assertPrints(numbers.map { it * it }, "[1, 4, 9]")
}
@Sample
fun flatMap() {
val list = listOf("123", "45")
assertPrints(list.flatMap { it.toList() }, "[1, 2, 3, 4, 5]")
}
@Sample
fun take() {
val chars = ('a'..'z').toList()