RxJava



rx.operators
Class OperationDistinct

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

public final class OperationDistinct
extends java.lang.Object

Returns an Observable that emits all distinct items emitted by the source. Be careful with this operation when using infinite or very large observables as it has to store all distinct values it has received.


Constructor Summary
OperationDistinct()
           
 
Method Summary
static
<T> Observable.OnSubscribeFunc<T>
distinct(Observable<? extends T> source)
          Returns an Observable that emits all distinct items emitted by the source
static
<T> Observable.OnSubscribeFunc<T>
distinct(Observable<? extends T> source, java.util.Comparator<T> equalityComparator)
          Returns an Observable that emits all distinct items emitted by the source
static
<T,U> Observable.OnSubscribeFunc<T>
distinct(Observable<? extends T> source, Func1<? super T,? extends U> keySelector)
          Returns an Observable that emits all distinct items emitted by the source
static
<T,U> Observable.OnSubscribeFunc<T>
distinct(Observable<? extends T> source, Func1<? super T,? extends U> keySelector, java.util.Comparator<U> equalityComparator)
          Returns an Observable that emits all distinct items emitted by the source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationDistinct

public OperationDistinct()
Method Detail

distinct

public static <T,U> Observable.OnSubscribeFunc<T> distinct(Observable<? extends T> source,
                                                           Func1<? super T,? extends U> keySelector)
Returns an Observable that emits all distinct items emitted by the source

Parameters:
source - The source Observable to emit the distinct items for.
Returns:
A subscription function for creating the target Observable.

distinct

public static <T> Observable.OnSubscribeFunc<T> distinct(Observable<? extends T> source,
                                                         java.util.Comparator<T> equalityComparator)
Returns an Observable that emits all distinct items emitted by the source

Parameters:
source - The source Observable to emit the distinct items for.
equalityComparator - The comparator to use for deciding whether to consider two items as equal or not.
Returns:
A subscription function for creating the target Observable.

distinct

public static <T,U> Observable.OnSubscribeFunc<T> distinct(Observable<? extends T> source,
                                                           Func1<? super T,? extends U> keySelector,
                                                           java.util.Comparator<U> equalityComparator)
Returns an Observable that emits all distinct items emitted by the source

Parameters:
source - The source Observable to emit the distinct items for.
equalityComparator - The comparator to use for deciding whether to consider the two item keys as equal or not.
Returns:
A subscription function for creating the target Observable.

distinct

public static <T> Observable.OnSubscribeFunc<T> distinct(Observable<? extends T> source)
Returns an Observable that emits all distinct items emitted by the source

Parameters:
source - The source Observable to emit the distinct items for.
Returns:
A subscription function for creating the target Observable.