Skip to content

Instantly share code, notes, and snippets.

@jw-koo
jw-koo / example.kt
Last active November 8, 2020 12:45
fun flowWithCombine() = runBlocking {
val intFlow = flowOf(1, 2, 3).delayEach(10)
val charFlow = flowOf("A", "B", "C").delayEach(20)
intFlow.combine(charFlow) { num, character ->
"$num / $character"
}.collect {
println(it)
}
}
14
Process finished with exit code 0