Shalom Halbert
11/07/2020, 8:30 AM9a
9b
9c
9d
9e
9fwhen it seemingly should be printing
1a
2a
3a
4a
5a
6a
7a
8abefore that?
@Test
fun example1(): Unit = runBlocking {
val flowA = flowOf(1, 2, 3, 4, 5, 6, 7, 8, 9)
val flowB = flowOf("a", "b", "c", "d", "e", "f").onEach { delay(1000) }
flowA.combine(flowB) { a, b -> "$a$b" }.collect { println(it) }
}
Shawn Witte
11/07/2020, 10:00 AMcombine
uses the most recent values: https://kotlinlang.org/docs/reference/coroutines/flow.html#combineShalom Halbert
11/07/2020, 10:22 AMdelay
on the first value of flowB
. Thank you 🙌Tijl
11/07/2020, 1:27 PMzip