H,
Sorry, I'm new to RxJava and having a question about how to use rx.Observable.
Here is my code
final Observable<SomeData> data1 =
getData(...);
final Observable<SomeData> data2 =
getData(...);
final Observable<SomeData> data3 =
getData(...);
return Observable.zip(
data1,
data2,
data3,
new Func3<SomeData, SomeData, SomeData, SomeData>() {
@Override
public SomeData call(
final SomeData d1,
final SomeData d2,
final SomeData d3) {
//do something and return SomeData
}
});
Here I use zip when all the data are present.
My question is that if data2 and data3 are not present (i.e., they are both null), I don't/shouldn't use Observable.zip to emit the function and get the returned value, so how should I do when I only have data1? Which API should I use if I take only one parameter (data1)? Also I will have to return SomeData instead of an Observable from the function.
Any help will be much appreciated!