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

OperatorUsing #1100

Merged
merged 1 commit into from
Apr 30, 2014
Merged

OperatorUsing #1100

merged 1 commit into from
Apr 30, 2014

Conversation

zsxwing
Copy link
Member

@zsxwing zsxwing commented Apr 25, 2014

Operator Using

Issue #1060

@cloudbees-pull-request-builder

RxJava-pull-requests #1011 SUCCESS
This pull request looks good

@akarnokd akarnokd mentioned this pull request Apr 25, 2014
57 tasks
@@ -2590,7 +2590,7 @@ public final Boolean call(T first, T second) {
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229585.aspx">MSDN: Observable.Using</a>
*/
public final static <T, RESOURCE extends Subscription> Observable<T> using(Func0<RESOURCE> resourceFactory, Func1<RESOURCE, Observable<T>> observableFactory) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are at it, could you rename RESOURCE to Resource. Same for the Operator's class def.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belay that, rather have the following signature

<T> Observable<T> using(Func0<? extends Subscription> resourceFactory, Func1<? super Subscription, ? extends Observable<? extends T>> observableFactory)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your proposal will require a cast in observableFactory if the user wants to use the Resource in observableFactory. So I changed to

public final static <T, Resource extends Subscription> Observable<T> using(
    Func0<Resource> resourceFactory, 
    Func1<Resource, ? extends Observable<? extends T>> observableFactory)

@cloudbees-pull-request-builder

RxJava-pull-requests #1021 SUCCESS
This pull request looks good

@benjchristensen benjchristensen merged commit af07b19 into ReactiveX:master Apr 30, 2014
@zsxwing zsxwing deleted the using branch April 30, 2014 03:02
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.

4 participants