RxJava



rx.operators
Class OperationDebounce

java.lang.Object
  extended by rx.operators.OperationDebounce

public final class OperationDebounce
extends java.lang.Object

This operation is used to filter out bursts of events. This is done by ignoring the events from an observable which are too quickly followed up with other values. Values which are not followed up by other values within the specified timeout are published as soon as the timeout expires.


Constructor Summary
OperationDebounce()
           
 
Method Summary
static
<T> Observable.OnSubscribeFunc<T>
debounce(Observable<T> items, long timeout, java.util.concurrent.TimeUnit unit)
          This operation filters out events which are published too quickly in succession.
static
<T> Observable.OnSubscribeFunc<T>
debounce(Observable<T> items, long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
          This operation filters out events which are published too quickly in succession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationDebounce

public OperationDebounce()
Method Detail

debounce

public static <T> Observable.OnSubscribeFunc<T> debounce(Observable<T> items,
                                                         long timeout,
                                                         java.util.concurrent.TimeUnit unit)
This operation filters out events which are published too quickly in succession. This is done by dropping events which are followed up by other events before a specified timer has expired. If the timer expires and no follow up event was published (yet) the last received event is published.

Parameters:
items - The Observable which is publishing events.
timeout - How long each event has to be the 'last event' before it gets published.
unit - The unit of time for the specified timeout.
Returns:
A Func1 which performs the throttle operation.

debounce

public static <T> Observable.OnSubscribeFunc<T> debounce(Observable<T> items,
                                                         long timeout,
                                                         java.util.concurrent.TimeUnit unit,
                                                         Scheduler scheduler)
This operation filters out events which are published too quickly in succession. This is done by dropping events which are followed up by other events before a specified timer has expired. If the timer expires and no follow up event was published (yet) the last received event is published.

Parameters:
items - The Observable which is publishing events.
timeout - How long each event has to be the 'last event' before it gets published.
unit - The unit of time for the specified timeout.
scheduler - The Scheduler to use internally to manage the timers which handle timeout for each event.
Returns:
A Func1 which performs the throttle operation.