Skip to content

Commit 78b243e

Browse files
Merge pull request ReactiveX#452 from zsxwing/return
Implemented the scheduler version of the 'Return' operator
2 parents 5cab689 + bb39358 commit 78b243e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,23 @@ public static <T> Observable<T> just(T value) {
10141014
return from(list);
10151015
}
10161016

1017+
/**
1018+
* Returns an Observable that emits a single item and then completes on a specified scheduler.
1019+
* <p>
1020+
* This is a scheduler version of {@link Observable#just(Object)}.
1021+
*
1022+
* @param value
1023+
* the item to pass to the {@link Observer}'s {@link Observer#onNext onNext} method
1024+
* @param scheduler
1025+
* the scheduler to send the single element on
1026+
* @param <T>
1027+
* the type of that item
1028+
* @return an Observable that emits a single item and then completes on a specified scheduler.
1029+
*/
1030+
public static <T> Observable<T> just(T value, Scheduler scheduler) {
1031+
return just(value).observeOn(scheduler);
1032+
}
1033+
10171034
/**
10181035
* Flattens a sequence of Observables emitted by an Observable into one Observable, without any
10191036
* transformation.

0 commit comments

Comments
 (0)