Skip to content
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

Merged
merged 6 commits into from
Sep 25, 2013

Conversation

zsxwing
Copy link
Member

@zsxwing zsxwing commented Sep 23, 2013

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!

*
* @see <a href="http://msdn.microsoft.com/en-us/library/hh211842(v=vs.103).aspx">MSDN: Observable.Cast</a>
*/
public <R> Observable<R> cast() {
Copy link
Contributor

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 :)

@daveray
Copy link
Contributor

daveray commented Sep 23, 2013

Also, this needs a unit test. Thanks for contributing!

@cloudbees-pull-request-builder

RxJava-pull-requests #303 ABORTED

@zsxwing
Copy link
Member Author

zsxwing commented Sep 23, 2013

Thanks. I added the klass parameter and unit tests.

@cloudbees-pull-request-builder

RxJava-pull-requests #304 ABORTED

@cloudbees-pull-request-builder

RxJava-pull-requests #305 ABORTED

@cloudbees-pull-request-builder

RxJava-pull-requests #306 ABORTED

@cloudbees-pull-request-builder

RxJava-pull-requests #307 ABORTED

@cloudbees-pull-request-builder

RxJava-pull-requests #308 ABORTED

@benjchristensen
Copy link
Member

Thank you @zsxwing for the contribution and @daveray for the review.

Looks good so merging.

benjchristensen added a commit that referenced this pull request Sep 25, 2013
Implemented the 'cast' and 'ofType' operators
@benjchristensen benjchristensen merged commit 6670080 into ReactiveX:master Sep 25, 2013
@zsxwing zsxwing deleted the cast branch September 26, 2013 02:07
rickbw pushed a commit to rickbw/RxJava that referenced this pull request Jan 9, 2014
Implemented the 'cast' and 'ofType' operators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants