Add flatMap sample KT-20357
This commit is contained in:
committed by
Ilya Gorbunov
parent
29b25e3901
commit
664d69b752
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user