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 'Empty' operator with scheduler #415

Merged
merged 3 commits into from
Oct 9, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions rxjava-core/src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,30 @@ public static <T> Observable<T> create(OnSubscribeFunc<T> func) {
* the type of the items (ostensibly) emitted by the Observable
* @return an Observable that returns no data to the {@link Observer} and immediately invokes
* the {@link Observer}'s {@link Observer#onCompleted() onCompleted} method
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229670(v=vs.103).aspx">MSDN: Observable.Empty Method</a>
*/
public static <T> Observable<T> empty() {
return from(new ArrayList<T>());
}

/**
* Returns an Observable that emits no data to the {@link Observer} and immediately invokes
* its {@link Observer#onCompleted onCompleted} method with the specified scheduler.
* <p>
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/empty.png">
* @param scheduler
* the scheduler to call the {@link Observer#onCompleted onCompleted} method.
* @param <T>
* the type of the items (ostensibly) emitted by the Observable
* @return an Observable that returns no data to the {@link Observer} and immediately invokes
* the {@link Observer}'s {@link Observer#onCompleted() onCompleted} method with
* the specified scheduler.
* @see <a href="http://msdn.microsoft.com/en-us/library/hh229066(v=vs.103).aspx">MSDN: Observable.Empty Method (IScheduler)</a>
*/
public static <T> Observable<T> empty(Scheduler scheduler) {
return Observable.<T>empty().subscribeOn(scheduler);
}

/**
* Returns an Observable that invokes an {@link Observer}'s {@link Observer#onError onError} method when the Observer subscribes to it
* <p>
Expand Down