So I have this combine publisher that say emits integers - 1,2,3,4,5,6,7,8,9,10,11 ....
These integers are though not always there. They are generated on the fly and sent to the publisher.
I am aware of the collect operator which when say called as .collect(5) gives me - [1,2,3,4,5], [6,7,8,9,10], ...
What I am instead looking for is somewhat like buffer and collect combined - [1,2,3,4,5], [2,3,4,5,6], [3,4,5,6,7] ....
Is there any way to do it without writing a custom operator? And if a custom operator is the way to go, can you provide some guidance towards that, I have not written a custom operator before. I hope what I am asking for is clear from the examples.
Thanks
Edit
This works, but I am not sure if this is the best solution -
publisher.zip(
publisher.dropFirst(),
publisher.dropFirst(2))