src/main/java/io/reactivex/Observable.java
@SuppressWarnings({ "rawtypes", "unchecked" })
    @CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public static <T> Observable<T> switchOnNext(ObservableSource<? extends ObservableSource<? extends T>> sources, int bufferSize) {
        ObjectHelper.requireNonNull(sources, "sources is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new ObservableSwitchMap(sources, Functions.identity(), bufferSize, false));
    }
@SuppressWarnings({ "rawtypes", "unchecked" })
    @CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public static <T> Observable<T> switchOnNext(ObservableSource<? extends ObservableSource<? extends T>> sources, int bufferSize) {
        ObjectHelper.requireNonNull(sources, "sources is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new ObservableSwitchMap(sources, Functions.identity(), bufferSize, false));
    }
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) @ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public static < T > Observable < T > switchOnNext ( ObservableSource < ? extends ObservableSource < ? extends T > > sources , int bufferSize ) { ObjectHelper . requireNonNull ( sources , "sources is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableSwitchMap ( sources , Functions . identity ( ) , bufferSize , false ) ) ; }
Converts an ObservableSource that emits ObservableSources into an ObservableSource that emits the items emitted by the
most recently emitted of those ObservableSources.
<p>
<img width="640" height="370" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/switchDo.png" alt="">
<p>
{@code switchOnNext} subscribes to an ObservableSource that emits ObservableSources. Each time it observes one of
these emitted ObservableSources, the ObservableSource returned by {@code switchOnNext} begins emitting the items
emitted by that ObservableSource. When a new ObservableSource is emitted, {@code switchOnNext} stops emitting items
from the earlier-emitted ObservableSource and begins emitting items from the new one.
<p>
The resulting ObservableSource completes if both the outer ObservableSource and the last inner ObservableSource, if any, complete.
If the outer ObservableSource signals an onError, the inner ObservableSource is disposed and the error delivered in-sequence.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code switchOnNext} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <T> the item type
@param sources
the source ObservableSource that emits ObservableSources
@param bufferSize
the number of items to prefetch from the inner ObservableSources
@return an Observable that emits the items emitted by the ObservableSource most recently emitted by the source
ObservableSource
@see <a href="http://reactivex.io/documentation/operators/switch.html">ReactiveX operators documentation: Switch</a>
Converts an ObservableSource that emits ObservableSources into an ObservableSource that emits the items emitted by the most recently emitted of those ObservableSources . <p > <img width = 640 height = 370 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / switchDo . png alt = > <p > { @code switchOnNext } subscribes to an ObservableSource that emits ObservableSources . Each time it observes one of these emitted ObservableSources the ObservableSource returned by { @code switchOnNext } begins emitting the items emitted by that ObservableSource . When a new ObservableSource is emitted { @code switchOnNext } stops emitting items from the earlier - emitted ObservableSource and begins emitting items from the new one . <p > The resulting ObservableSource completes if both the outer ObservableSource and the last inner ObservableSource if any complete . If the outer ObservableSource signals an onError the inner ObservableSource is disposed and the error delivered in - sequence . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code switchOnNext } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >