src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B, U extends Collection<? super T>> Flowable<U> buffer(Publisher<B> boundaryIndicator, Callable<U> bufferSupplier) {
        ObjectHelper.requireNonNull(boundaryIndicator, "boundaryIndicator is null");
        ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
        return RxJavaPlugins.onAssembly(new FlowableBufferExactBoundary<T, U, B>(this, boundaryIndicator, bufferSupplier));
    }
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <B, U extends Collection<? super T>> Flowable<U> buffer(Publisher<B> boundaryIndicator, Callable<U> bufferSupplier) {
        ObjectHelper.requireNonNull(boundaryIndicator, "boundaryIndicator is null");
        ObjectHelper.requireNonNull(bufferSupplier, "bufferSupplier is null");
        return RxJavaPlugins.onAssembly(new FlowableBufferExactBoundary<T, U, B>(this, boundaryIndicator, bufferSupplier));
    }
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < B , U extends Collection < ? super T > > Flowable < U > buffer ( Publisher < B > boundaryIndicator , Callable < U > bufferSupplier ) { ObjectHelper . requireNonNull ( boundaryIndicator , "boundaryIndicator is null" ) ; ObjectHelper . requireNonNull ( bufferSupplier , "bufferSupplier is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableBufferExactBoundary < T , U , B > ( this , boundaryIndicator , bufferSupplier ) ) ; }
Returns a Flowable that emits non-overlapping buffered items from the source Publisher each time the
specified boundary Publisher 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 Publisher causes the returned Publisher to emit the
latest buffer and complete. If either the source Publisher or the boundary Publisher 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>Backpressure:</b></dt>
<dd>This operator does not support backpressure as it is instead controlled by the {@code Publisher}
{@code boundary} 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 <U> the collection subclass type to buffer into
@param <B>
the boundary value type (ignored)
@param boundaryIndicator
the boundary Publisher
@param bufferSupplier
a factory function that returns an instance of the collection subclass to be used and returned
as the buffer
@return a Flowable that emits buffered items from the source Publisher when the boundary Publisher
emits an item
@see #buffer(Publisher, int)
@see <a href="http://reactivex.io/documentation/operators/buffer.html">ReactiveX operators documentation: Buffer</a>
Returns a Flowable that emits non - overlapping buffered items from the source Publisher each time the specified boundary Publisher 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 Publisher causes the returned Publisher to emit the latest buffer and complete . If either the source Publisher or the boundary Publisher 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 > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it is instead controlled by the { @code Publisher } { @code boundary } 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 >