Created
June 24, 2016 17:50
-
-
Save Marchuck/6737c1c5e7cd1e22929ac60a53aa8630 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String[] getIds = new String[]{"id:0", "id:1", "id:2", "id:3"}; | |
| rx.Observable.just(getIds) | |
| .flatMap(new Func1<String[], Observable<String>>() { | |
| @Override | |
| public Observable<String> call(String[] strings) { | |
| //dla kazdego id odpytaj api | |
| return Observable.from(strings); | |
| } | |
| }).flatMap(new Func1<String, Observable<Integer>>() { | |
| @Override | |
| public Observable<Integer> call(String osoba) { | |
| //get na szczegóły osoby | |
| return Observable.just(osoba.length()); | |
| } | |
| }, new Func2<String, Integer, Boolean>() { | |
| @Override | |
| public Boolean call(String osoba, Integer szczegoly) { | |
| //save to realm: osoba wraz z jej szczegółami | |
| return true; | |
| } | |
| }).subscribe(new Action1<Boolean>() { | |
| @Override | |
| public void call(Boolean aBoolean) { | |
| //onNext | |
| } | |
| }, new Action1<Throwable>() { | |
| @Override | |
| public void call(Throwable throwable) { | |
| //onError | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment