问题
If flatMap()
is equivalent to map().mergeAll()
,
then what is switchMap()
equivalent to ?
回答1:
The switchMap()
operator is equivalent to using map().switch()
.
Since the switch()
operator works only with higher-order Observables the preceding map()
has to return an Observable. There's no switchAll()
operator because the switch()
operator already works with higher-order Observables(just like all *all()
operators).
来源:https://stackoverflow.com/questions/43165848/what-is-switchmap-equivalent-to-in-unflattened-form