|
36 | 36 | import rx.operators.OperationConcat;
|
37 | 37 | import rx.operators.OperationDefer;
|
38 | 38 | import rx.operators.OperationDematerialize;
|
| 39 | +import rx.operators.OperationDistinctUntilChanged; |
39 | 40 | import rx.operators.OperationFilter;
|
40 | 41 | import rx.operators.OperationFinally;
|
41 | 42 | import rx.operators.OperationFirstOrDefault;
|
@@ -2925,6 +2926,30 @@ public Observable<T> filter(Func1<? super T, Boolean> predicate) {
|
2925 | 2926 | return create(OperationFilter.filter(this, predicate));
|
2926 | 2927 | }
|
2927 | 2928 |
|
| 2929 | + /** |
| 2930 | + * Returns an Observable that forwards all sequentially distinct items emitted from the source Observable. |
| 2931 | + * |
| 2932 | + * @return an Observable of sequentially distinct items |
| 2933 | + * @see <a href="http://msdn.microsoft.com/en-us/library/hh229494%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a> |
| 2934 | + */ |
| 2935 | + public Observable<T> distinctUntilChanged() { |
| 2936 | + return create(OperationDistinctUntilChanged.distinctUntilChanged(this)); |
| 2937 | + } |
| 2938 | + |
| 2939 | + /** |
| 2940 | + * Returns an Observable that forwards all items emitted from the source Observable that are sequentially distinct according to |
| 2941 | + * a key selector function. |
| 2942 | + * |
| 2943 | + * @param keySelector |
| 2944 | + * a function that projects an emitted item to a key value which is used for deciding whether an item is sequentially |
| 2945 | + * distinct from another one or not |
| 2946 | + * @return an Observable of sequentially distinct items |
| 2947 | + * @see <a href="http://msdn.microsoft.com/en-us/library/hh229508%28v=vs.103%29.aspx">MSDN: Observable.distinctUntilChanged</a> |
| 2948 | + */ |
| 2949 | + public <U> Observable<T> distinctUntilChanged(Func1<? super T, ? extends U> keySelector) { |
| 2950 | + return create(OperationDistinctUntilChanged.distinctUntilChanged(this, keySelector)); |
| 2951 | + } |
| 2952 | + |
2928 | 2953 | /**
|
2929 | 2954 | * Registers an {@link Action0} to be called when this Observable invokes {@link Observer#onCompleted onCompleted} or {@link Observer#onError onError}.
|
2930 | 2955 | * <p>
|
|
0 commit comments