Closed
Description
Hi, I'm relatively new to RxJava.
I tried RxJava 2.0.6 (previously 2.0.5) to check if it still produces the same result.
Here my code (still using Java 6)
Maybe<String> m1 = Maybe.create(new MaybeOnSubscribe<String>() {
@Override public void subscribe(MaybeEmitter<String> e) throws Exception {
System.out.println("m1 called");
e.onSuccess("m1");
}
});
Maybe<String> m2 = Maybe.create(new MaybeOnSubscribe<String>() {
@Override public void subscribe(MaybeEmitter<String> e) throws Exception {
System.out.println("m2 called");
e.onSuccess("m2");
}
});
Disposable subscribe = Maybe.concat(m1, m2)
.firstElement()
.subscribe(new Consumer<String>() {
@Override public void accept(String t) throws Exception {
System.out.println(t);
}
});
the output :
m1 called
m1
m2 called
Is it correct or not? Because while using Observable, the second Observable is not called when the first one already emit value
Thanks