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 ;)
    }
});
This entry was posted in Java, Retrofit, RxJava. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">