I have an observable that emits Timers. I also hav...
# rx
g
I have an observable that emits Timers. I also have an observable that emits Ints. How can I combine them such that an Int will be emitted followed by the timer? i.e. given an array of ints [1,2,3] and timers [2s, 4s, 3s] 1 (then wait 2 s) 2 (then wait 4 s) 3 (then wait 3 s)
g
Can you use
zip
?
g
It seems that zip cannot achieve the example because the BiFunction must wait for both emissions to complete to produce a new type of emission.
It’s really easy to make the following happen: (wait 2s) emit 1, (wait 4s) emit 2, (wait 3s) emit 3 but I would like the delay to be a post-delay if possible
What seems to be working for me is just mapping the Timers to their values first, and zipping them with the ints to do a blocking sleep or new Timer in a .map or .doOnNext