src/main/java/io/reactivex/Observable.java
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <TOpening, TClosing> Observable<List<T>> buffer(
            ObservableSource<? extends TOpening> openingIndicator,
            Function<? super TOpening, ? extends ObservableSource<? extends TClosing>> closingIndicator) {
        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.<T>asCallable());
    }
@CheckReturnValue
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <TOpening, TClosing> Observable<List<T>> buffer(
            ObservableSource<? extends TOpening> openingIndicator,
            Function<? super TOpening, ? extends ObservableSource<? extends TClosing>> closingIndicator) {
        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.<T>asCallable());
    }
@ CheckReturnValue @ SchedulerSupport ( SchedulerSupport . NONE ) public final < TOpening , TClosing > Observable < List < T > > buffer ( ObservableSource < ? extends TOpening > openingIndicator , Function < ? super TOpening , ? extends ObservableSource < ? extends TClosing > > closingIndicator ) { return buffer ( openingIndicator , closingIndicator , ArrayListSupplier . < T > asCallable ( ) ) ; }
Returns an Observable that emits buffers of items it collects from the source ObservableSource. The resulting
ObservableSource emits buffers that it creates when the specified {@code openingIndicator} ObservableSource emits an
item, and closes when the ObservableSource returned from {@code closingIndicator} emits an item. If any of the
source ObservableSource, {@code openingIndicator} or {@code closingIndicator} issues an onError notification the
event is passed on immediately without first emitting the buffer it is in the process of assembling.
<p>
<img width="640" height="470" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/buffer2.png" alt="">
<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 <TOpening> the element type of the buffer-opening ObservableSource
@param <TClosing> the element type of the individual buffer-closing ObservableSources
@param openingIndicator
the ObservableSource that, when it emits an item, causes a new buffer to be created
@param closingIndicator
the {@link Function} that is used to produce an ObservableSource for every buffer created. When this
ObservableSource emits an item, the associated buffer is emitted.
@return an Observable that emits buffers, containing items from the source ObservableSource, that are created
and closed when the specified ObservableSources emit items
@see <a href="http://reactivex.io/documentation/operators/buffer.html">ReactiveX operators documentation: Buffer</a>
Returns an Observable that emits buffers of items it collects from the source ObservableSource . The resulting ObservableSource emits buffers that it creates when the specified { @code openingIndicator } ObservableSource emits an item and closes when the ObservableSource returned from { @code closingIndicator } emits an item . If any of the source ObservableSource { @code openingIndicator } or { @code closingIndicator } issues an onError notification the event is passed on immediately without first emitting the buffer it is in the process of assembling . <p > <img width = 640 height = 470 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / buffer2 . png alt = > <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >