src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @NonNull
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <U> Flowable<T> sample(Publisher<U> sampler) {
        ObjectHelper.requireNonNull(sampler, "sampler is null");
        return RxJavaPlugins.onAssembly(new FlowableSamplePublisher<T>(this, sampler, false));
    }
@CheckReturnValue
    @NonNull
    @BackpressureSupport(BackpressureKind.ERROR)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <U> Flowable<T> sample(Publisher<U> sampler) {
        ObjectHelper.requireNonNull(sampler, "sampler is null");
        return RxJavaPlugins.onAssembly(new FlowableSamplePublisher<T>(this, sampler, false));
    }
@ CheckReturnValue @ NonNull @ BackpressureSupport ( BackpressureKind . ERROR ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final < U > Flowable < T > sample ( Publisher < U > sampler ) { ObjectHelper . requireNonNull ( sampler , "sampler is null" ) ; return RxJavaPlugins . onAssembly ( new FlowableSamplePublisher < T > ( this , sampler , false ) ) ; }
Returns a Flowable that, when the specified {@code sampler} Publisher emits an item or completes,
emits the most recently emitted item (if any) emitted by the source Publisher since the previous
emission from the {@code sampler} Publisher.
<p>
<img width="640" height="289" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/sample.o.nolast.png" alt="">
<dl>
<dt><b>Backpressure:</b></dt>
<dd>This operator does not support backpressure as it uses the emissions of the {@code sampler}
Publisher to control data flow.</dd>
<dt><b>Scheduler:</b></dt>
<dd>This version of {@code sample} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param <U> the element type of the sampler Publisher
@param sampler
the Publisher to use for sampling the source Publisher
@return a Flowable that emits the results of sampling the items emitted by this Publisher whenever
the {@code sampler} Publisher emits an item or completes
@see <a href="http://reactivex.io/documentation/operators/sample.html">ReactiveX operators documentation: Sample</a>
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a>
Returns a Flowable that when the specified { @code sampler } Publisher emits an item or completes emits the most recently emitted item ( if any ) emitted by the source Publisher since the previous emission from the { @code sampler } Publisher . <p > <img width = 640 height = 289 src = https : // raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / sample . o . nolast . png alt = > <dl > <dt > <b > Backpressure : < / b > < / dt > <dd > This operator does not support backpressure as it uses the emissions of the { @code sampler } Publisher to control data flow . < / dd > <dt > <b > Scheduler : < / b > < / dt > <dd > This version of { @code sample } does not operate by default on a particular { @link Scheduler } . < / dd > < / dl >