@@ -731,7 +731,7 @@ public static <T> Observable<T> error(Throwable exception, Scheduler scheduler)
731731 * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#from">RxJava Wiki: from()</a>
732732 */
733733 public static <T > Observable <T > from (Iterable <? extends T > iterable ) {
734- return create ( OperationToObservableIterable . toObservableIterable ( iterable ));
734+ return from ( iterable , Schedulers . currentThread ( ));
735735 }
736736
737737 /**
@@ -750,7 +750,7 @@ public static <T> Observable<T> from(Iterable<? extends T> iterable) {
750750 * @see <a href="http://msdn.microsoft.com/en-us/library/hh212140.aspx">MSDN: Observable.ToObservable</a>
751751 */
752752 public static <T > Observable <T > from (Iterable <? extends T > iterable , Scheduler scheduler ) {
753- return from ( iterable ). observeOn ( scheduler );
753+ return create ( OperationToObservableIterable . toObservableIterable ( iterable , scheduler ) );
754754 }
755755
756756 /**
@@ -763,14 +763,35 @@ public static <T> Observable<T> from(Iterable<? extends T> iterable, Scheduler s
763763 * {@link Subscription} is returned, it is not possible to unsubscribe from
764764 * the sequence before it completes.
765765 *
766- * @param items the source sequence
766+ * @param items the source array
767767 * @param <T> the type of items in the Array and the type of items to be
768768 * emitted by the resulting Observable
769769 * @return an Observable that emits each item in the source Array
770770 * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#from">RxJava Wiki: from()</a>
771771 */
772772 public static <T > Observable <T > from (T [] items ) {
773- return create (OperationToObservableIterable .toObservableIterable (Arrays .asList (items )));
773+ return from (Arrays .asList (items ));
774+ }
775+
776+ /**
777+ * Converts an Array into an Observable.
778+ * <p>
779+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/from.png">
780+ * <p>
781+ * Note: the entire array is immediately emitted each time an
782+ * {@link Observer} subscribes. Since this occurs before the
783+ * {@link Subscription} is returned, it is not possible to unsubscribe from
784+ * the sequence before it completes.
785+ *
786+ * @param items the source array
787+ * @param scheduler the scheduler to emit the items of the array
788+ * @param <T> the type of items in the Array and the type of items to be
789+ * emitted by the resulting Observable
790+ * @return an Observable that emits each item in the source Array
791+ * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#from">RxJava Wiki: from()</a>
792+ */
793+ public static <T > Observable <T > from (T [] items , Scheduler scheduler ) {
794+ return from (Arrays .asList (items ), scheduler );
774795 }
775796
776797 /**
@@ -827,7 +848,7 @@ public static <T> Observable<T> from(T t1, T t2) {
827848 * subscribes. Since this occurs before the {@link Subscription} is
828849 * returned, it is not possible to unsubscribe from the sequence before it
829850 * completes.
830- *
851+ *
831852 * @param t1 first item
832853 * @param t2 second item
833854 * @param t3 third item
@@ -1012,11 +1033,6 @@ public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T
10121033 * <p>
10131034 * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/from.png">
10141035 * <p>
1015- * Note: the items will be immediately emitted each time an {@link Observer}
1016- * subscribes. Since this occurs before the {@link Subscription} is
1017- * returned, it is not possible to unsubscribe from the sequence before it
1018- * completes.
1019- *
10201036 * @param t1 first item
10211037 * @param t2 second item
10221038 * @param t3 third item
@@ -1044,11 +1060,6 @@ public static <T> Observable<T> from(T t1, T t2, T t3, T t4, T t5, T t6, T t7, T
10441060 * <p>
10451061 * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/range.png">
10461062 * <p>
1047- * Note: the entire range is immediately emitted each time an
1048- * {@link Observer} subscribes. Since this occurs before the
1049- * {@link Subscription} is returned, it is not possible to unsubscribe from
1050- * the sequence before it completes.
1051- *
10521063 * @param start the value of the first Integer in the sequence
10531064 * @param count the number of sequential Integers to generate
10541065 * @return an Observable that emits a range of sequential Integers
@@ -1073,7 +1084,7 @@ public static Observable<Integer> range(int start, int count) {
10731084 * @see <a href="http://msdn.microsoft.com/en-us/library/hh211896.aspx">Observable.Range Method (Int32, Int32, IScheduler)</a>
10741085 */
10751086 public static Observable <Integer > range (int start , int count , Scheduler scheduler ) {
1076- return range ( start , count ). observeOn ( scheduler );
1087+ return from ( Range . createWithCount ( start , count ), scheduler );
10771088 }
10781089
10791090 /**
@@ -1120,10 +1131,7 @@ public static <T> Observable<T> defer(Func0<? extends Observable<? extends T>> o
11201131 * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#just">RxJava Wiki: just()</a>
11211132 */
11221133 public static <T > Observable <T > just (T value ) {
1123- List <T > list = new ArrayList <T >();
1124- list .add (value );
1125-
1126- return from (list );
1134+ return from (Arrays .asList ((value )));
11271135 }
11281136
11291137 /**
@@ -1142,7 +1150,7 @@ public static <T> Observable<T> just(T value) {
11421150 * @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#just">RxJava Wiki: just()</a>
11431151 */
11441152 public static <T > Observable <T > just (T value , Scheduler scheduler ) {
1145- return just ( value ). observeOn ( scheduler );
1153+ return from ( Arrays . asList (( value )), scheduler );
11461154 }
11471155
11481156 /**
0 commit comments