-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
The JavaDoc of switchOnNext()
doesn't currently say anything about how the resulting Observable will complete.
The marble diagram implies (but not totally clearly) that if an inner Observable completes after an outer onNext()
, that completion is swallowed, and if an inner Observable completes after the outer Observable completes, that the resulting Observable also completes.
However, there's no info about what happens in an inner Observable completes before an outer onNext()
. Does the resulting Observable complete at that point or not?
I've read the tests, and it seems the answer is that the resulting Observable will complete exactly when the following happen, in this order:
- the outer Observable completes (implying that the current inner Observable will never be switched to any other);
- the current inner Observable completes.
And that the resulting Observable won't complete under any other circumstances.
Firstly, is my understanding correct, and secondly, can the JavaDoc be improved?