|
34 | 34 | import rx.operators.OperationCache;
|
35 | 35 | import rx.operators.OperationCombineLatest;
|
36 | 36 | import rx.operators.OperationConcat;
|
| 37 | +import rx.operators.OperationDebounce; |
37 | 38 | import rx.operators.OperationDefer;
|
38 | 39 | import rx.operators.OperationDematerialize;
|
39 |
| -import rx.operators.OperationDistinctUntilChanged; |
40 | 40 | import rx.operators.OperationDistinct;
|
| 41 | +import rx.operators.OperationDistinctUntilChanged; |
41 | 42 | import rx.operators.OperationFilter;
|
42 | 43 | import rx.operators.OperationFinally;
|
43 | 44 | import rx.operators.OperationFirstOrDefault;
|
|
53 | 54 | import rx.operators.OperationOnErrorResumeNextViaObservable;
|
54 | 55 | import rx.operators.OperationOnErrorReturn;
|
55 | 56 | import rx.operators.OperationOnExceptionResumeNextViaObservable;
|
| 57 | +import rx.operators.OperationParallel; |
56 | 58 | import rx.operators.OperationRetry;
|
57 | 59 | import rx.operators.OperationSample;
|
58 | 60 | import rx.operators.OperationScan;
|
|
67 | 69 | import rx.operators.OperationTakeUntil;
|
68 | 70 | import rx.operators.OperationTakeWhile;
|
69 | 71 | import rx.operators.OperationThrottleFirst;
|
70 |
| -import rx.operators.OperationDebounce; |
71 | 72 | import rx.operators.OperationTimestamp;
|
72 | 73 | import rx.operators.OperationToObservableFuture;
|
73 | 74 | import rx.operators.OperationToObservableIterable;
|
@@ -1773,15 +1774,13 @@ public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? e
|
1773 | 1774 | * its {@link Observer}s; it invokes {@code onCompleted} or {@code onError} only once; and it never invokes {@code onNext} after invoking either {@code onCompleted} or {@code onError}.
|
1774 | 1775 | * {@code synchronize} enforces this, and the Observable it returns invokes {@code onNext} and {@code onCompleted} or {@code onError} synchronously.
|
1775 | 1776 | *
|
1776 |
| - * @param observable |
1777 |
| - * the source Observable |
1778 | 1777 | * @param <T>
|
1779 | 1778 | * the type of item emitted by the source Observable
|
1780 | 1779 | * @return an Observable that is a chronologically well-behaved version of the source
|
1781 | 1780 | * Observable, and that synchronously notifies its {@link Observer}s
|
1782 | 1781 | */
|
1783 |
| - public static <T> Observable<T> synchronize(Observable<? extends T> observable) { |
1784 |
| - return create(OperationSynchronize.synchronize(observable)); |
| 1782 | + public Observable<T> synchronize() { |
| 1783 | + return create(OperationSynchronize.synchronize(this)); |
1785 | 1784 | }
|
1786 | 1785 |
|
1787 | 1786 |
|
@@ -3484,6 +3483,31 @@ public Observable<T> cache() {
|
3484 | 3483 | return create(OperationCache.cache(this));
|
3485 | 3484 | }
|
3486 | 3485 |
|
| 3486 | + /** |
| 3487 | + * Perform work in parallel by sharding an {@code Observable<T>} on a {@link Schedulers#threadPoolForComputation()} {@link Scheduler} and return an {@code Observable<R>} with the output. |
| 3488 | + * |
| 3489 | + * @param f |
| 3490 | + * a {@link Func1} that applies Observable operators to {@code Observable<T>} in parallel and returns an {@code Observable<R>} |
| 3491 | + * @return an Observable with the output of the {@link Func1} executed on a {@link Scheduler} |
| 3492 | + */ |
| 3493 | + public <R> Observable<R> parallel(Func1<Observable<T>, Observable<R>> f) { |
| 3494 | + return OperationParallel.parallel(this, f); |
| 3495 | + } |
| 3496 | + |
| 3497 | + /** |
| 3498 | + * Perform work in parallel by sharding an {@code Observable<T>} on a {@link Scheduler} and return an {@code Observable<R>} with the output. |
| 3499 | + * |
| 3500 | + * @param f |
| 3501 | + * a {@link Func1} that applies Observable operators to {@code Observable<T>} in parallel and returns an {@code Observable<R>} |
| 3502 | + * @param s |
| 3503 | + * a {@link Scheduler} to perform the work on. |
| 3504 | + * @return an Observable with the output of the {@link Func1} executed on a {@link Scheduler} |
| 3505 | + */ |
| 3506 | + |
| 3507 | + public <R> Observable<R> parallel(final Func1<Observable<T>, Observable<R>> f, final Scheduler s) { |
| 3508 | + return OperationParallel.parallel(this, f, s); |
| 3509 | + } |
| 3510 | + |
3487 | 3511 | /**
|
3488 | 3512 | * Returns a {@link ConnectableObservable}, which waits until its {@link ConnectableObservable#connect connect} method is called before it begins emitting
|
3489 | 3513 | * items to those {@link Observer}s that have subscribed to it.
|
|
0 commit comments