-
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
Implemented distinctUntilChanged operation #374
Implemented distinctUntilChanged operation #374
Conversation
RxJava-pull-requests #269 SUCCESS |
RxJava-pull-requests #271 SUCCESS |
What about a method that takes a java.util.Comparator? |
@abersnaze I don't know. It's possible (and easy), of course. I just don't see much of a use case. But maybe that's just me. |
If there was an Observable of some object and they either didn't implement equals correctly or a different criteria for equality was needed then (in Java) this operator couldn't be used as is. I work around be to use map before to wrap the object that implements a different equals then a map after it to unwrap it. |
You could also use the |
The point I was trying to make was that I think it would be inconvenient and not in line with most of the other java APIs that involve comparing values. This brings up another concern that I have is how to deal with instance operators that require some additional constraints on the values emitted. In this case it only works if equals is implemented correctly. Then there is the no arg version toSortedList() that casts the values to Comparable. Some of the other method only operate on Observable<Observable>. The only way to ensure that is to have them as static where the generics can be specific to that method. I thought about making a toComparableObservable(Comparator) where the sorting APIs could live or a toObservableOfObservable() where zip and merge could be instance methods. There are many problems with this idea.
|
I tend to agree that we should have the |
Implemented distinctUntilChanged operation
Implemented distinctUntilChanged operation
This is the implementation for
distinctUntilChanged
as described in #39.I haven't implemented the two methods from .NET that are using an
IEqualityComparator
because I don't think it would be idiomatic Java to define an interface like this and use that here. - Or does somebody want that?