https://kotlinlang.org logo
#flow
Title
# flow
m

Marcin Wisniowski

08/11/2021, 10:12 PM
Hello, I'm looking for a combination of
debounce()
and
distinctUntilChanged()
. I want to debounce elements if they are the same. So
A B B C D
in quick succession will become
A B C D
. I can't just use
distinctUntilChanged()
, because I want to allow sending the same element twice, as long as it's not in quick succession. How would I achieve that?
f

Francesc

08/12/2021, 9:13 PM
you seem to describe just
debounce
, "I want to allow sending the same element twice as long as it's not in quick succession" is just plain
debounce
. If you need to customize it, you can always look at the implementation of
debounce
and make your own variant based on it
3 Views