Skip to content

Commit 25910ee

Browse files
committed
Zip with iterable, removed old aggregator version and updated tests
1 parent fe438ca commit 25910ee

File tree

3 files changed

+524
-393
lines changed

3 files changed

+524
-393
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,6 +2626,40 @@ public static <T1, T2, R> Observable<R> zip(Observable<? extends T1> o1, Observa
26262626
return create(OperationZip.zip(o1, o2, zipFunction));
26272627
}
26282628

2629+
/**
2630+
* Return an Observable that pairs up values from this Observable and the other
2631+
* Observable and applies a function.
2632+
* @param <T2> the other value type
2633+
* @param <R> the result type
2634+
* @param other the other Observable sequence
2635+
* @param zipFunction the function that combines the pairs of items from both
2636+
* observables and returns a new value
2637+
* @return an Observable that pairs up values from this Observable and the other
2638+
* Observable and applies a function.
2639+
*/
2640+
public <T2, R> Observable<R> zip(Observable<? extends T2> other, Func2<? super T, ? super T2, ? extends R> zipFunction) {
2641+
return zip(this, other, zipFunction);
2642+
}
2643+
2644+
/**
2645+
* Return an Observable that pairs up values from this Observable and an
2646+
* Iterable sequence and applies a function.
2647+
* <p>
2648+
* Note that the other Iterable is evaluated as items appear from this
2649+
* Observable and is not pre-consumed, allowing zipping infinite streams
2650+
* on either side.
2651+
* @param <T2> the other value type
2652+
* @param <R> the result type
2653+
* @param other the other Iterable sequence
2654+
* @param zipFunction the function that combines the pairs of items of
2655+
* this Observable and the Iterable
2656+
* @return an Observable that pairs up values from this Observable and an
2657+
* Iterable sequence and applies a function.
2658+
*/
2659+
public <T2, R> Observable<R> zip(Iterable<? extends T2> other, Func2<? super T, ? super T2, ? extends R> zipFunction) {
2660+
return create(OperationZip.zipIterable(this, other, zipFunction));
2661+
}
2662+
26292663
/**
26302664
* Returns an Observable that emits the results of a function of your
26312665
* choosing applied to combinations of three items emitted, in sequence, by

0 commit comments

Comments
 (0)