what is the diference between flatmap and concatmap?
See original GitHub issue- what is the diference between flatmap and concatmap?
- `A.concatmap(b).subscribe(subscriber)``, if the b call the onComplete, subsriber’s onComplete will not be invoked? why? the same as flatmap.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (6 by maintainers)
Top Results From Across the Web
What is the difference between concatMap and flatMap in ...
FlatMap takes emissions from source observable, then create new observable and merge it to original chain, while concatMap concat it to original chain....
Read more >RxJava: FlatMap, SwitchMap and ConcatMap differences ...
FlatMap. Lets start with a simple Java unit test that is testing flatMap operator. · SwitchMap. The same test, the same conditions, but...
Read more >Webflux - flatmap vs concatmap | full-stack front/>
What is a difference between flatMap and concatMap? It's really, important to understand a difference. I'll try to explain it as simple as ......
Read more >RxJava Observable tranformation: concatMap() vs flatMap().
flatMap() uses MERGE operator while concatMap() uses CONCAT operator meaning that the last one cares about the order of the elements, so keep...
Read more >RxJava: flatMap() vs. concatMap() vs. concatMapEager()
flatMap() should be your first weapon of choice. It allows efficient concurrency with streaming behavior. But be prepared to receive results out ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Marble diagrams showing the difference:
concatMap is sequential: http://reactivex.io/RxJava/javadoc/rx/Observable.html#concatMap(rx.functions.Func1) flatMap is concurrent: http://reactivex.io/RxJava/javadoc/rx/Observable.html#flatMap(rx.functions.Func1)
Note the interleaving on flatMap.
concatMap
‘runs’ only a single source Observable at a time whereasflatMap
subscribes to many of them and if those Observables are async, you get async execution and interleaved emissions between Observables, but values from each of the Observables retain the relative order to each other.b
andA
is also terminating properly, then you should get anonCompleted()
event. Do you have a test case which exhibits the behavior you mentioned?