Deliver the first item immediately, ‘debounce’ following items

Update: From @lopar’s comments a better way would be: Observable.from(items).publish(publishedItems -> publishedItems.limit(1).concatWith(publishedItems.skip(1).debounce(1, TimeUnit.SECONDS))) Would something like this work: String[] items = {“one”, “two”, “three”, “four”, “five”}; Observable<String> myObservable = Observable.from(items); Observable.concat( myObservable.first(), myObservable.skip(1).debounce(1, TimeUnit.SECONDS) ).subscribe(s -> System.out.println(s));

Combine a list of Observables and wait until all completed

You can use flatMap in case you have dynamic tasks composition. Something like this: public Observable<Boolean> whenAll(List<Observable<Boolean>> tasks) { return Observable.from(tasks) //execute in parallel .flatMap(task -> task.observeOn(Schedulers.computation())) //wait, until all task are executed //be aware, all your observable should emit onComplete event //otherwise you will wait forever .toList() //could implement more intelligent logic. eg. check … Read more

Get response status code using Retrofit 2.0 and RxJava

Instead of declaring the API call like you did: Observable<MyResponseObject> apiCall(@Body body); You can also declare it like this: Observable<Response<MyResponseObject>> apiCall(@Body body); You will then have a Subscriber like the following: new Subscriber<Response<StartupResponse>>() { @Override public void onCompleted() {} @Override public void onError(Throwable e) { Timber.e(e, “onError: %”, e.toString()); // network errors, e. g. UnknownHostException, … Read more