Skip to content

Instantly share code, notes, and snippets.

@ragdroid
Created August 10, 2016 14:40
Show Gist options
  • Save ragdroid/3db661f26dd431bc119e40c117fc7382 to your computer and use it in GitHub Desktop.
Save ragdroid/3db661f26dd431bc119e40c117fc7382 to your computer and use it in GitHub Desktop.
Rxify - Droidcon 2016 Example of using a zip() RxJava operator Raw
//Preparing a polyjuice? Simple cast the spell - Zippyosa !!
Observable<PolyJuice> getPolyJuiceObservable() {
Observable<FluxWeed> ronObservable = getFluxWeedObservable();
Observable<CrabHair> harryObservable = getHairObservable();
return Observable.zip(ronObservable, harryObservable, new Func2<FluxWeed, CrabHair, PolyJuice>() {
@Override
public PolyJuice call(final FluxWeed fluxWeed, final CrabHair crabHair) {
return new PolyJuice(fluxWeed, crabHair)
.prepare();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment