Skip to content

Commit

Permalink
Merge pull request ReactiveX#415 from zsxwing/empty-with-scheduler
Browse files Browse the repository at this point in the history
Implemented the 'Empty' operator with scheduler
  • Loading branch information
benjchristensen committed Oct 9, 2013
2 parents da429ea + d7a45d4 commit b8ae284
Showing 1 changed file with 19 additions and 0 deletions.
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 @@ -544,11 +544,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

0 comments on commit b8ae284

Please sign in to comment.