Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

flatMap() and the order of events – RxJava FAQ

As we already discovered, flatMap() does not preserve the order of original stream. Let’s illustrate this using the GeoNames API example from previous article: public interface GeoNames { Flowable populationOf(String city); } By requesting population of multiple cities using flatMap() we have no guarantee that they will arrive in order: Flowable cities = Flowable.just("Warsaw", "Paris", "London", "Madrid"); cities .flatMap(geoNames::populationOf) .subscribe(response -> log.info("Population: ...



This post first appeared on Java Code Geeks, please read the originial post: here

Share the post

flatMap() and the order of events – RxJava FAQ

×

Subscribe to Java Code Geeks

Get updates delivered right to your inbox!

Thank you for your subscription

×