src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <TOpening, TClosing> Flowable<List<T>> buffer(
            Flowable<? extends TOpening> openingIndicator,
            Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator) {
        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.<T>asCallable());
    }
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <TOpening, TClosing> Flowable<List<T>> buffer(
            Flowable<? extends TOpening> openingIndicator,
            Function<? super TOpening, ? extends Publisher<? extends TClosing>> closingIndicator) {
        return buffer(openingIndicator, closingIndicator, ArrayListSupplier.<T>asCallable());
    }
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < TOpening , TClosing > Flowable < List < T > > buffer ( Flowable < ? extends TOpening > openingIndicator , Function < ? super TOpening , ? extends Publisher < ? extends TClosing > > closingIndicator ) { return buffer ( openingIndicator , closingIndicator , ArrayListSupplier . < T > asCallable ( ) ) ; }
Returns a Flowable that emits buffers of items it collects from the source Publisher. The resulting
Publisher emits buffers that it creates when the specified {@code openingIndicator} Publisher emits an
item, and closes when the Publisher returned from {@code closingIndicator} emits an item. If any of the source
Publisher, {@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>Backpressure:</b></dt>
<dd>This operator does not support backpressure as it is instead controlled by the given Publishers and
buffers data. It requests {@code Long.MAX_VALUE} upstream and does not obey downstream requests.</dd>
<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 Publisher
@param <TClosing> the element type of the individual buffer-closing Publishers
@param openingIndicator
the Publisher that, when it emits an item, causes a new buffer to be created
@param closingIndicator
the {@link Function} that is used to produce a Publisher for every buffer created. When this
Publisher emits an item, the associated buffer is emitted.
@return a Flowable that emits buffers, containing items from the source Publisher, that are created
and closed when the specified Publishers emit items
@see <a href="http://reactivex.io/documentation/operators/buffer.html">ReactiveX operators documentation: Buffer</a>
Returns a Flowable that emits buffers of items it collects from the source Publisher . The resulting Publisher emits buffers that it creates when the specified { @code openingIndicator } Publisher emits an item and closes when the Publisher returned from { @code closingIndicator } emits an item . If any of the source Publisher { @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 > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the given Publishers and buffers data . It requests { @code Long . MAX_VALUE } upstream and does not obey downstream requests . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code buffer } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >