We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5e5052 commit ffeec50Copy full SHA for ffeec50
app/src/main/java/com/lukaslechner/coroutineusecasesonandroid/playground/flow/concurrency/8_conflate.kt
@@ -0,0 +1,24 @@
1
+package com.lukaslechner.coroutineusecasesonandroid.playground.flow.concurrency
2
+
3
+import kotlinx.coroutines.coroutineScope
4
+import kotlinx.coroutines.delay
5
+import kotlinx.coroutines.flow.conflate
6
+import kotlinx.coroutines.flow.flow
7
8
+suspend fun main() = coroutineScope {
9
10
+ val flow = flow {
11
+ repeat(5) {
12
+ println("Emitter: Start Cooking Pancake $it")
13
+ delay(100)
14
+ println("Emitter: Pancake $it ready!")
15
+ emit(it)
16
+ }
17
+ }.conflate()
18
19
+ flow.collect {
20
+ println("Collector: Start eating pancake $it")
21
+ delay(300)
22
+ println("Collector: Finished eating pancake $it")
23
24
+}
0 commit comments