Marc Knaup
12/25/2020, 4:07 PM.conflate().map { … } and .conflate().mapLatest { … }?bezrukov
12/25/2020, 5:27 PMflow {
repeat(20) {
emit(it)
delay(100)
}
}.conflate()
.mapLatest { // change to map to see difference.
delay(250)
it
}.collect {
println(it)
}
If map's body is perfectly supports cooperative cancellation, there is no conflate() necessary.Marc Knaup
12/25/2020, 5:54 PMmapLatest makes the conflate pointless and not the other way round 👍bezrukov
12/25/2020, 6:30 PMdelay in map to Thread.sleep and you will see that conflate may be important even with mapLatest