|
15 | 15 | */
|
16 | 16 | package rx;
|
17 | 17 |
|
18 |
| -import static org.junit.Assert.*; |
19 |
| -import static org.mockito.Matchers.*; |
20 |
| -import static org.mockito.Mockito.*; |
21 |
| - |
22 | 18 | import java.util.ArrayList;
|
23 | 19 | import java.util.Arrays;
|
24 | 20 | import java.util.Collection;
|
|
27 | 23 | import java.util.concurrent.Future;
|
28 | 24 | import java.util.concurrent.TimeUnit;
|
29 | 25 |
|
30 |
| - |
31 | 26 | import rx.concurrency.Schedulers;
|
32 | 27 | import rx.observables.BlockingObservable;
|
33 | 28 | import rx.observables.ConnectableObservable;
|
34 | 29 | import rx.observables.GroupedObservable;
|
35 | 30 | import rx.operators.OperationAll;
|
36 | 31 | import rx.operators.OperationBuffer;
|
37 | 32 | import rx.operators.OperationCache;
|
| 33 | +import rx.operators.OperationCombineLatest; |
38 | 34 | import rx.operators.OperationConcat;
|
39 | 35 | import rx.operators.OperationDefer;
|
40 | 36 | import rx.operators.OperationDematerialize;
|
@@ -1085,6 +1081,38 @@ public static <R, T0, T1, T2, T3> Observable<R> zip(Observable<T0> w0, Observabl
|
1085 | 1081 | return create(OperationZip.zip(w0, w1, w2, w3, reduceFunction));
|
1086 | 1082 | }
|
1087 | 1083 |
|
| 1084 | + /** |
| 1085 | + * Combines the given observables, emitting an event containing an aggregation of the latest values of each of the source observables |
| 1086 | + * each time an event is received from one of the source observables, where the aggregation is defined by the given function. |
| 1087 | + * <p> |
| 1088 | + * <img width="640" src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/combineLatest.png"> |
| 1089 | + * |
| 1090 | + * @param w0 |
| 1091 | + * The first source observable. |
| 1092 | + * @param w1 |
| 1093 | + * The second source observable. |
| 1094 | + * @param combineFunction |
| 1095 | + * The aggregation function used to combine the source observable values. |
| 1096 | + * @return An Observable that combines the source Observables with the given combine function |
| 1097 | + */ |
| 1098 | + public static <R, T0, T1> Observable<R> combineLatest(Observable<T0> w0, Observable<T1> w1, Func2<T0, T1, R> combineFunction) { |
| 1099 | + return create(OperationCombineLatest.combineLatest(w0, w1, combineFunction)); |
| 1100 | + } |
| 1101 | + |
| 1102 | + /** |
| 1103 | + * @see #combineLatest(Observable, Observable, Func2) |
| 1104 | + */ |
| 1105 | + public static <R, T0, T1, T2> Observable<R> combineLatest(Observable<T0> w0, Observable<T1> w1, Observable<T2> w2, Func3<T0, T1, T2, R> combineFunction) { |
| 1106 | + return create(OperationCombineLatest.combineLatest(w0, w1, w2, combineFunction)); |
| 1107 | + } |
| 1108 | + |
| 1109 | + /** |
| 1110 | + * @see #combineLatest(Observable, Observable, Func2) |
| 1111 | + */ |
| 1112 | + public static <R, T0, T1, T2, T3> Observable<R> combineLatest(Observable<T0> w0, Observable<T1> w1, Observable<T2> w2, Observable<T3> w3, Func4<T0, T1, T2, T3, R> combineFunction) { |
| 1113 | + return create(OperationCombineLatest.combineLatest(w0, w1, w2, w3, combineFunction)); |
| 1114 | + } |
| 1115 | + |
1088 | 1116 | /**
|
1089 | 1117 | * Creates an Observable which produces buffers of collected values.
|
1090 | 1118 | *
|
|
0 commit comments