There are two operators that can serve your offer.
Zip :

Link for RxJs: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/zip.md
CombineLatest :

Link for RxJs: https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/core/operators/combinelatest.md
Images explain the differences between the two. Now you have combined the observable, which you just need to filter using where , which will filter if one of the values โโis null.
Unfortunately, none of the operators can get the behavior you described:
Stream A : A, B, C, D, E.... Stream B : 1, null, 2, null, 3.... Composed : (A,1),(B,1),(C,2),(D,2)....
If you use Zip and Where (after filtering the null values โโafter), the result will be:
Composed: (A,1),(C,2),(E,3)
If you use Where (filtering zero values โโearlier) and Zip, the result will be:
Composed: (A,1),(B,2),(C,3)
If you use CombineLatest, it will depend on the order in which events occur in the streams, and, of course, where you put the where statement, the result may differ from what you showed, for example:
Stream A : A, B, C, D.... Stream B : 1, null, 2, null.... Composed : (A,1),(B,1),(C,1),(C,2),(D,2)....
If you do not have more specific requirements, I think one of the options that I talked about is what you are looking for, do not hesitate to add information.
There are several ways to create observables, other not mentioned operators:
- distinctUntilChanged , can be added to the final composition, using the key selection function to limit only the zip part or the last value.
- switch used to combine one observable inside another.