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 picture and quote I understand that flatMap allows the creation of more (or fewer) elements than it was
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 of a variable(user) when I build a chain(nested flatMap…) like this
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.toList()); used to keep an
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 flatMap. There seems to be some subtle difference in the description of resulting Observable, where one