Created
July 30, 2015 09:46
-
-
Save mariusk/e0b020f1fdb7badfa8fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Observable<Integer> oi = Observable.create(new OnSubscribe<Integer>() { | |
@Override | |
public void call(Subscriber<? super Integer> subscriber) { | |
// we now receive a Subscriber instead of Observer | |
for (int i = 1; i < 1000000; i++) { | |
// the OnSubscribe can now check for isUnsubscribed | |
if (subscriber.isUnsubscribed()) { | |
return; | |
} | |
subscriber.onNext(i); | |
} | |
subscriber.onCompleted(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've only gotten this far: