distinctUntilChanged

fun <T> Observable<T>.distinctUntilChanged(comparator: (T, T) -> Boolean = ::equals): Observable<T>

Returns an Observable that emits all elements emitted by the source Observable that are distinct from their immediate predecessors when compared with each other via the provided comparator.

Please refer to the corresponding RxJava document.


fun <T, R> Observable<T>.distinctUntilChanged(keySelector: (T) -> R, comparator: (R, R) -> Boolean = ::equals): Observable<T>

Returns an Observable that emits all elements emitted by the source Observable that are distinct from their immediate predecessors. Each emitted element is mapped to a key using the provided keySelector. Each pair of sibling keys is compared using the provided comparator.

Please refer to the corresponding RxJava document.