Add sample for Map.asSequence (#5055)

This commit is contained in:
Takumi Maeomote
2022-12-16 01:58:38 +09:00
committed by GitHub
parent a529f8510d
commit c4f83adc2a
3 changed files with 11 additions and 1 deletions
@@ -75,6 +75,14 @@ class Sequences {
assertPrints(sequence.joinToString(), "a, b, c")
}
@Sample
fun sequenceFromMap() {
val map = mapOf(1 to "x", 2 to "y", -1 to "zz")
val sequence = map.asSequence()
assertPrints(sequence.joinToString(), "1=x, 2=y, -1=zz")
}
@Sample
fun sequenceFromIterator() {
val array = arrayOf(1, 2, 3)