@@ -8930,7 +8930,57 @@ public final Flowable<T> debounce(long timeout, @NonNull TimeUnit unit) {
89308930 public final Flowable<T> debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler) {
89318931 Objects.requireNonNull(unit, "unit is null");
89328932 Objects.requireNonNull(scheduler, "scheduler is null");
8933- return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler));
8933+ return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler, null));
8934+ }
8935+
8936+ /**
8937+ * Returns a {@code Flowable} that mirrors the current {@code Flowable}, except that it drops items emitted by the
8938+ * current {@code Flowable} that are followed by newer items before a timeout value expires on a specified
8939+ * {@link Scheduler}. The timer resets on each emission.
8940+ * <p>
8941+ * <em>Note:</em> If items keep being emitted by the current {@code Flowable} faster than the timeout then no items
8942+ * will be emitted by the resulting {@code Flowable}.
8943+ * <p>
8944+ * <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/debounce.s.v3.png" alt="">
8945+ * <p>
8946+ * Delivery of the item after the grace period happens on the given {@code Scheduler}'s
8947+ * {@code Worker} which if takes too long, a newer item may arrive from the upstream, causing the
8948+ * {@code Worker}'s task to get disposed, which may also interrupt any downstream blocking operation
8949+ * (yielding an {@code InterruptedException}). It is recommended processing items
8950+ * that may take long time to be moved to another thread via {@link #observeOn} applied after
8951+ * {@code debounce} itself.
8952+ * <dl>
8953+ * <dt><b>Backpressure:</b></dt>
8954+ * <dd>This operator does not support backpressure as it uses time to control data flow.</dd>
8955+ * <dt><b>Scheduler:</b></dt>
8956+ * <dd>You specify which {@code Scheduler} this operator will use.</dd>
8957+ * </dl>
8958+ *
8959+ * @param timeout
8960+ * the time each item has to be "the most recent" of those emitted by the current {@code Flowable} to
8961+ * ensure that it's not dropped
8962+ * @param unit
8963+ * the unit of time for the specified {@code timeout}
8964+ * @param scheduler
8965+ * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each
8966+ * item
8967+ * @param onDropped
8968+ * called with the current entry when it has been replaced by a new one
8969+ * @return the new {@code Flowable} instance
8970+ * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null}
8971+ * @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a>
8972+ * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a>
8973+ * @see #throttleWithTimeout(long, TimeUnit, Scheduler)
8974+ */
8975+ @CheckReturnValue
8976+ @NonNull
8977+ @BackpressureSupport(BackpressureKind.ERROR)
8978+ @SchedulerSupport(SchedulerSupport.CUSTOM)
8979+ public final Flowable<T> debounce(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer<T> onDropped) {
8980+ Objects.requireNonNull(unit, "unit is null");
8981+ Objects.requireNonNull(scheduler, "scheduler is null");
8982+ Objects.requireNonNull(onDropped, "onDropped is null");
8983+ return RxJavaPlugins.onAssembly(new FlowableDebounceTimed<>(this, timeout, unit, scheduler, onDropped));
89348984 }
89358985
89368986 /**
@@ -17587,6 +17637,47 @@ public final Flowable<T> throttleWithTimeout(long timeout, @NonNull TimeUnit uni
1758717637 return debounce(timeout, unit, scheduler);
1758817638 }
1758917639
17640+ /**
17641+ * Returns a {@code Flowable} that mirrors the current {@code Flowable}, except that it drops items emitted by the
17642+ * current {@code Flowable} that are followed by newer items before a timeout value expires on a specified
17643+ * {@link Scheduler}. The timer resets on each emission (alias to {@link #debounce(long, TimeUnit, Scheduler)}).
17644+ * <p>
17645+ * <em>Note:</em> If items keep being emitted by the current {@code Flowable} faster than the timeout then no items
17646+ * will be emitted by the resulting {@code Flowable}.
17647+ * <p>
17648+ * <img width="640" height="305" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/throttleWithTimeout.s.v3.png" alt="">
17649+ * <dl>
17650+ * <dt><b>Backpressure:</b></dt>
17651+ * <dd>This operator does not support backpressure as it uses time to control data flow.</dd>
17652+ * <dt><b>Scheduler:</b></dt>
17653+ * <dd>You specify which {@code Scheduler} this operator will use.</dd>
17654+ * </dl>
17655+ *
17656+ * @param timeout
17657+ * the length of the window of time that must pass after the emission of an item from the current
17658+ * {@code Flowable} in which it emits no items in order for the item to be emitted by the
17659+ * resulting {@code Flowable}
17660+ * @param unit
17661+ * the unit of time for the specified {@code timeout}
17662+ * @param scheduler
17663+ * the {@code Scheduler} to use internally to manage the timers that handle the timeout for each
17664+ * item
17665+ * @param onDropped
17666+ * called with the current entry when it has been replaced by a new one
17667+ * @return the new {@code Flowable} instance
17668+ * @throws NullPointerException if {@code unit} or {@code scheduler} is {@code null} or {@code onDropped} is {@code null}
17669+ * @see <a href="http://reactivex.io/documentation/operators/debounce.html">ReactiveX operators documentation: Debounce</a>
17670+ * @see <a href="https://github.com/ReactiveX/RxJava/wiki/Backpressure">RxJava wiki: Backpressure</a>
17671+ * @see #debounce(long, TimeUnit, Scheduler)
17672+ */
17673+ @CheckReturnValue
17674+ @BackpressureSupport(BackpressureKind.ERROR)
17675+ @SchedulerSupport(SchedulerSupport.CUSTOM)
17676+ @NonNull
17677+ public final Flowable<T> throttleWithTimeout(long timeout, @NonNull TimeUnit unit, @NonNull Scheduler scheduler, @NonNull Consumer<T> onDropped) {
17678+ return debounce(timeout, unit, scheduler, onDropped);
17679+ }
17680+
1759017681 /**
1759117682 * Returns a {@code Flowable} that emits records of the time interval between consecutive items emitted by the
1759217683 * current {@code Flowable}.
0 commit comments