android - Throw exception only for last item in RxJava chain -
i have list of wifi adresses in android app. also, there wifimanager accept address , connect if possible. connection procedure rxjava completable, throws exception in case of connection failure. how can check adresses 1 1, , throw exception if last adress failed?
just suppress errors in last completable
list<string> addresses = ... int s = address.size(); flowable.range(0, s) .flatmapcompletable(index -> { completable c = manager.checkaddress(addresses.get(index)); if (index != s - 1) { c = c.onerrorcomplete(); } return c; }, false, 1) .subscribe(...)
Comments
Post a Comment