Full outer join of two ordered observables

Viewed 508

Suppose we have two observables Observable<Integer> o1 and Observable<Integer> o2 and each observable is producing strictly increasing sequence.

The task is to perform equivalent of full outer join on these two observables. For example join of

    Observable.just(0, 2, 3, 6)
    Observable.just(1, 2, 3, 4, 5, 6)

should produce

    [ [0, _], [_, 1], [2, 2], [3, 3], [_, 4], [_, 5], [6, 6] ]

The join should be efficient and work well on very large or infinite streams.

The solution is easy in pull scenario. Is there an idiomatic rx way to achieve this?

1 Answers
Related