-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Design Review: Replay Selector T -> R without ConnectableObservable #677
Comments
I never understood this operator, and the current implementation works different than Rx.NET. public class ReplayMulticast {
public static void main(String[] args) {
Observable<Integer> source = Observable.from(1, 2, 3, 4)
.doOnNext(v -> {
System.out.println("Sideeffect");
});
Observable<Integer> result = source.replay(o -> o.take(2));
for (int i = 1; i < 3; i++) {
System.out.printf("- %d -%n", i);
result.subscribe(System.out::println, Throwable::printStackTrace,
() -> System.out.println("Done")
);
}
}
} that prints
An infinite stream would never stop. Rx.NET prints
Regardless, I don't get the operator. |
Replay has way to many overloads ... (personally I never use replay, so I am not the right person to ask which ones to keep :-) |
@headinthebox Now is the time for a review of these and deleting any if we want to. |
Can you specify which ones so we don't confuse each other on subjective non-obvious decisions? |
Here are all the overloads. The ones that create a
And the corresponding ones that take a function and create a regular observable:
These latter ones are similar to the If you like |
@akarnokd The .NET behavior is the correct one. When you call |
@headinthebox thanks, I suspected so. Luckily, the issue I mentioned above was fixed and RxJava should behave as Rx.NET now. |
@akarnokd great! and @benjchristensen sorry for not being able to prune this bunch, but it makes Rx extra |
Closing out ... review has decided that what we have is what we want. Thanks @akarnokd and @headinthebox |
Why are there
replay
overloads that:map
operator?Observable
instead ofConnectableObservable
?It seems that someone should just use
observable.map(T -> R).replay()
and that it should always returnConnectableObservable
./cc @headinthebox and @jhusain
The text was updated successfully, but these errors were encountered: