I’ve read that wonderful answer about the difference between map and flatMap. And there is a picture that demonstrates flatmap: And quote: The map is for synchronous, non-blocking, one-to-one transformations while the flatMap is for asynchronous (non-blocking) One-to-Many transformations. Based on that …
Tag: flatmap
flatMap reuse response from reactive call
Currently, I have a question, something like this: User X Y The question is how do I reuse correctly the “user” and the “x” response from the previous call? Here are my solutions for marked(*) place: nested flatMap(), then can thenReturn(user) for next map(). Any issue with the scope o…
Flatmap nested collection
I have a list of objects, some of them can be collections. I would like to get a stream of plain objects. I would like to get a stream with elements. I have tried I also checked an example which shows how to use a recursive function which flattens a collection. However, in this example .collect(Collectors.toL…
What is the difference between concatMap and flatMap in RxJava
It seems that these 2 functions are pretty similar. They have same signature (accepting rx.functions.Func1<? super T, ? extends Observable<? extends R>> func), and their marble diagrams look exactly same. Can’t paste the pics here, but here’s one for concatMap, and here’s one for…