Observable.zip()

public interface Api {
 
    @GET("x")
    Observable<X> getX();
 
    @GET("y")
    Observable<Y> getY();
 
}
Observable.zip(api.getX(), api.getY(), new Func2<X, Y, Pair>() {
    @Override
    public Pair call(X x, Y y) {
        return new Pair(x, y);
    }
}).subscribe(new Action1<Pair>() {
    @Override
    public void call(Pair pair) {
        // you got pair ;)
    }
});

Leave a Reply

Your email address will not be published. Required fields are marked *