I used to develop a lot in rxJava1 for Android and I loved the zip Operator. Unfortunately I can't get it running on rxJava2. Please can someone help me out? I'm trying to do the following
Observable
.zip(
Observable.just(“1”),
Observable.just(“2"),
Observable.just(“3”),
Observable.just(“4"),
new Func4<String, String, String, String, MyResult>() {
@Override
public MyResult call(String string1, String string2, String string3, String string4) {
return new MyResult(string1, string2, string3, string4);
}
});
Change it to
Java implementation:
Flowable.zip(
Flowable.just("1"),
Flowable.just("2"),
Flowable.just("3"),
Flowable.just("4"),
new Function4<String, String, String, String, MyResult >() {
@Override
public MyResult apply(t1: String, t2: String, t3: String, t4: String) {
// return MyResult
}
})
Kotlin implementation:
Flowable.zip(
Flowable.just("1"),
Flowable.just("2"),
Flowable.just("3"),
Flowable.just("4"),
object : Function4<String, String, String, String, MyResult > {
override fun apply(t1: String, t2: String, t3: String, t4: String): MyResult {
// return MyResult
}
})