Hi there. I'm looking for a way to collect `Observ...
# rx
u
Hi there. I'm looking for a way to collect `Observable`'s emissions in bundles of data, some sort of history of the last values. I know it sound like
buffer()
operator, but I just can't get it right. When having
A
,
B
,
C
,
D
,
E
,
F
emitted one after another with some delay, I would like to have an
Observable
emitting:
[A]
,
[A, B]
,
[A,B,C]
,
[B, C, D]
,
[C, D, E]
,
[D, E, F]
. We are only interested in last values, so I suppose, we could use here a
Flowable
. Thanks.
g
You could use
.scan
and use some kind of queue/stack structure like
Deque
as the accumulator
👍 2
u
thanks
a
I've had to implement this multiple times unfortunately. Really what you're looking for is
combineLatest
but that emits a tuple or whatever with null values until every stream has emitted