https://kotlinlang.org logo
Title
p

Paul Woitaschek

11/06/2018, 1:56 PM
Is there sth like
ReceiveChannel#distinctUntilChanged
?
e

elizarov

11/06/2018, 1:57 PM
If you use
Channel(Channel.CONFLATED)
, then only distinct changes will be reported
p

Paul Woitaschek

11/06/2018, 1:59 PM
So the same is true for
BroadcastChannel
?
e

elizarov

11/06/2018, 2:00 PM
You should use
ConflatedBroadcastChannel
, then
p

Paul Woitaschek

11/06/2018, 2:01 PM
Why?
e

elizarov

11/06/2018, 2:02 PM
It does what you are looking for — “distinct until changed”
p

Paul Woitaschek

11/06/2018, 2:02 PM
Why are the channels built by
Channel
internal, but the channels built by
BroadcastChannel
public?
e

elizarov

11/06/2018, 2:03 PM
The provides an expanded API. You can read the most recently sent
value
without actually opening subscription.
p

Paul Woitaschek

11/06/2018, 2:06 PM
Thanks that's was helpful.