What is the difference between flatmap and switchmap in RxJava?

后端 未结 7 1805
忘掉有多难
忘掉有多难 2020-11-29 15:07

The rxjava doc definition of switchmap is rather vague and it links to the same page as flatmap. What is the difference between the two operators?

7条回答
  •  青春惊慌失措
    2020-11-29 15:49

    switchMap was once called flatMapLatest in RxJS 4.

    It basically just passes on the events from the latest Observable and unsubscribes from the previous one.

提交回复
热议问题