src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B> Observable<Observable<T>> window(Callable<? extends ObservableSource<B>> boundary, int bufferSize) {
        ObjectHelper.requireNonNull(boundary, "boundary is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new ObservableWindowBoundarySupplier<T, B>(this, boundary, bufferSize));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B> Observable<Observable<T>> window(Callable<? extends ObservableSource<B>> boundary, int bufferSize) {
        ObjectHelper.requireNonNull(boundary, "boundary is null");
        ObjectHelper.verifyPositive(bufferSize, "bufferSize");
        return RxJavaPlugins.onAssembly(new ObservableWindowBoundarySupplier<T, B>(this, boundary, bufferSize));
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B > Observable < Observable < T > > window ( Callable < ? extends ObservableSource < B > > boundary , int bufferSize ) { ObjectHelper . requireNonNull ( boundary , "boundary is null" ) ; ObjectHelper . verifyPositive ( bufferSize , "bufferSize" ) ; return RxJavaPlugins . onAssembly ( new ObservableWindowBoundarySupplier < T , B > ( this , boundary , bufferSize ) ) ; }
Returns an Observable that emits windows of items it collects from the source ObservableSource. The resulting
ObservableSource emits connected, non-overlapping windows. It emits the current window and opens a new one
whenever the ObservableSource produced by the specified {@code closingIndicator} emits an item.
<p>
<img width="640" height="455" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/window1.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>This version of {@code window} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <B> the element type of the boundary ObservableSource
@param boundary
a {@link Callable} that returns an {@code ObservableSource} that governs the boundary between windows.
When the source {@code ObservableSource} emits an item, {@code window} emits the current window and begins
a new one.
@param bufferSize
the capacity hint for the buffer in the inner windows
@return an Observable that emits connected, non-overlapping windows of items from the source ObservableSource
whenever {@code closingIndicator} emits an item
@see <a href="http://reactivex.io/documentation/operators/window.html">ReactiveX operators documentation: Window</a>
Returns an Observable that emits windows of items it collects from the source ObservableSource . The resulting ObservableSource emits connected non - overlapping windows . It emits the current window and opens a new one whenever the ObservableSource produced by the specified { @code closingIndicator } emits an item . <p > <img width = 640 height = 455 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / window1 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code window } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >