|
40 | 40 | import rx.operators.OperationDefer;
|
41 | 41 | import rx.operators.OperationDematerialize;
|
42 | 42 | import rx.operators.OperationFilter;
|
| 43 | +import rx.operators.OperationWhere; |
43 | 44 | import rx.operators.OperationMap;
|
44 | 45 | import rx.operators.OperationMaterialize;
|
45 | 46 | import rx.operators.OperationMerge;
|
@@ -722,6 +723,21 @@ public Boolean call(T t1) {
|
722 | 723 | });
|
723 | 724 | }
|
724 | 725 |
|
| 726 | + /** |
| 727 | + * Filters an Observable by discarding any of its emissions that do not meet some test. |
| 728 | + * <p> |
| 729 | + * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/filter.png"> |
| 730 | + * |
| 731 | + * @param that |
| 732 | + * the Observable to filter |
| 733 | + * @param predicate |
| 734 | + * a function that evaluates the items emitted by the source Observable, returning <code>true</code> if they pass the filter |
| 735 | + * @return an Observable that emits only those items in the original Observable that the filter evaluates as true |
| 736 | + */ |
| 737 | + public static <T> Observable<T> where(Observable<T> that, Func1<T, Boolean> predicate) { |
| 738 | + return _create(OperationWhere.where(that, predicate)); |
| 739 | + } |
| 740 | + |
725 | 741 | /**
|
726 | 742 | * Converts an {@link Iterable} sequence to an Observable sequence.
|
727 | 743 | *
|
@@ -2419,6 +2435,21 @@ public Boolean call(T t1) {
|
2419 | 2435 | });
|
2420 | 2436 | }
|
2421 | 2437 |
|
| 2438 | + /** |
| 2439 | + * Filters an Observable by discarding any of its emissions that do not meet some test. |
| 2440 | + * <p> |
| 2441 | + * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/filter.png"> |
| 2442 | + * |
| 2443 | + * @param predicate |
| 2444 | + * a function that evaluates the items emitted by the source Observable, returning |
| 2445 | + * <code>true</code> if they pass the filter |
| 2446 | + * @return an Observable that emits only those items in the original Observable that the filter |
| 2447 | + * evaluates as <code>true</code> |
| 2448 | + */ |
| 2449 | + public Observable<T> where(Func1<T, Boolean> predicate) { |
| 2450 | + return where(this, predicate); |
| 2451 | + } |
| 2452 | + |
2422 | 2453 | /**
|
2423 | 2454 | * Returns the last element of an observable sequence with a specified source.
|
2424 | 2455 | *
|
|
0 commit comments