-
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 the 'cast' and 'ofType' operators #403
Conversation
* | ||
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211842(v=vs.103).aspx">MSDN: Observable.Cast</a> | ||
*/ | ||
public <R> Observable<R> cast() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this signature should be Observable<R> cast(Class<R> klass)
. Then you can use klass.cast(t)
and won't need to suppress unchecked warnings. Also, it will mean that a ClassCastException
will be generated here rather than at some random place downstream.
My signature will need to be adjusted by the co/contra-variance police, of course :)
Also, this needs a unit test. Thanks for contributing! |
RxJava-pull-requests #303 ABORTED |
Thanks. I added the klass parameter and unit tests. |
RxJava-pull-requests #304 ABORTED |
RxJava-pull-requests #305 ABORTED |
RxJava-pull-requests #306 ABORTED |
RxJava-pull-requests #307 ABORTED |
RxJava-pull-requests #308 ABORTED |
Implemented the 'cast' and 'ofType' operators
Implemented the 'cast' and 'ofType' operators
Hi,
I used 'map' to implement the 'cast' operator #26. I also used 'cast' to implement the 'ofType' operator #67.
Please take a look. Thanks!