src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B, U extends Collection<? super T>> Observable<U> buffer(ObservableSource<B> boundary, Callable<U> bufferSupplier) {
        ObjectHelper.requireNonNull(boundary, "boundary is null");
        ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
        return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<T, U, B>(this, boundary, bufferSupplier));
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B, U extends Collection<? super T>> Observable<U> buffer(ObservableSource<B> boundary, Callable<U> bufferSupplier) {
        ObjectHelper.requireNonNull(boundary, "boundary is null");
        ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
        return RxJavaPlugins.onAssembly(new ObservableBufferExactBoundary<T, U, B>(this, boundary, bufferSupplier));
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B , U extends Collection < ? super T > > Observable < U > buffer ( ObservableSource < B > boundary , Callable < U > bufferSupplier ) { ObjectHelper . requireNonNull ( boundary , "boundary is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new ObservableBufferExactBoundary < T , U , B > ( this , boundary , bufferSupplier ) ) ; }
Returns an Observable that emits non-overlapping buffered items from the source ObservableSource each time the
specified boundary ObservableSource emits an item.
<p>
<img width="640" height="395" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer8.png" alt="">
<p>
Completion of either the source or the boundary ObservableSource causes the returned ObservableSource to emit the
latest buffer and complete. If either the source ObservableSource or the boundary ObservableSource issues an
onError notification the event is passed on immediately without first emitting the buffer it is in the process of
assembling.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>This version of {@code buffer} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <U> the collection subclass type to buffer into
@param <B>
the boundary value type (ignored)
@param boundary
the boundary ObservableSource
@param bufferSupplier
a factory function that returns an instance of the collection subclass to be used and returned
as the buffer
@return an Observable that emits buffered items from the source ObservableSource when the boundary ObservableSource
emits an item
@see #buffer(ObservableSource, int)
@see <a href="http://reactivex.io/documentation/operators/buffer.html">ReactiveX operators documentation: Buffer</a>
Returns an Observable that emits non - overlapping buffered items from the source ObservableSource each time the specified boundary ObservableSource emits an item . <p > <img width = 640 height = 395 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer8 . png alt = > <p > Completion of either the source or the boundary ObservableSource causes the returned ObservableSource to emit the latest buffer and complete . If either the source ObservableSource or the boundary ObservableSource issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >