-
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
Idiomatic filtering of values. #768
Comments
We do not have a collection of common predicates. The closest to this idea we have currently is the |
Guava has lots of predicates that could be reused here but that would be another dependency. As a simplified solution ReactiveCocoa has the At the moment what I need is a simple method to ignore the default value of a BehaviorSubject. Filtering out Obviously |
That sounds you need PublishSubject instead of BehaviorSubject as the former doesn't have a default value. |
But I need the 1 long buffer. That's why publishsubject + buffer + map 2014/1/21 akarnokd [email protected]
|
So you need the latest value when someone subscribes but not an initial value? This can be achieved via replay(int). |
There is a fundamental difference between behavior subject and publish Now the question is whether there is a 2014/1/21 akarnokd [email protected]
|
Here is how filtering can be done: public class TestFilter {
public static void main(String[] args) {
Observable.range(0, 20).filter(i -> i % 2 == 0).subscribe(System.out::println);
Observable.range(0, 20).filter(TestFilter::filterEven).subscribe(System.out::println);
}
public static boolean filterEven(int i) {
return i % 2 != 0;
}
} If a library of common filters is desired, that could be a good contrib module, but does not belong in the core. |
Update `Battle of the Circuit Breakers: Resilience4J vs Istio` from slides to Youtube talk
Is there a predicate to filter out
null
values or any values from a signal? Currently a new function has to be created to do this but it would be easy to create a general function.The text was updated successfully, but these errors were encountered: