ishandutta2007
ishandutta2007

Reputation: 18214

What is switchMap equivalent to in unflattened form?

If flatMap() is equivalent to map().mergeAll(), then what is switchMap() equivalent to ?

Upvotes: 2

Views: 354

Answers (1)

martin
martin

Reputation: 96909

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).

Upvotes: 4

Related Questions