File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
rxjava-core/src/main/java/rx Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1012,6 +1012,31 @@ public static <T> Observable<T> just(T value) {
1012
1012
return from (list );
1013
1013
}
1014
1014
1015
+ /**
1016
+ * Returns an Observable that emits a single item and then completes in a specified scheduler.
1017
+ * <p>
1018
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/just.png">
1019
+ * <p>
1020
+ * To convert any object into an Observable that emits that object, pass that object into the
1021
+ * <code>just</code> method.
1022
+ * <p>
1023
+ * This is similar to the {@link #from(java.lang.Object[])} method, except that
1024
+ * <code>from()</code> will convert an {@link Iterable} object into an Observable that emits
1025
+ * each of the items in the Iterable, one at a time, while the <code>just()</code> method
1026
+ * converts an Iterable into an Observable that emits the entire Iterable as a single item.
1027
+ *
1028
+ * @param value
1029
+ * the item to pass to the {@link Observer}'s {@link Observer#onNext onNext} method
1030
+ * @param scheduler
1031
+ * the scheduler to send the single element on
1032
+ * @param <T>
1033
+ * the type of that item
1034
+ * @return an Observable that emits a single item and then completes
1035
+ */
1036
+ public static <T > Observable <T > just (T value , Scheduler scheduler ) {
1037
+ return just (value ).observeOn (scheduler );
1038
+ }
1039
+
1015
1040
/**
1016
1041
* Flattens a sequence of Observables emitted by an Observable into one Observable, without any
1017
1042
* transformation.
You can’t perform that action at this time.
0 commit comments