@@ -1996,11 +1996,31 @@ public static <T> Observable<T> toObservable(Iterable<T> iterable) {
1996
1996
* the type of of object that the future's returns and the type emitted by the resulting
1997
1997
* Observable
1998
1998
* @return an Observable that emits the item from the source Future
1999
+ * @deprecated Replaced by {@link #from(Future)}
1999
2000
*/
2000
2001
public static <T > Observable <T > toObservable (Future <T > future ) {
2001
2002
return create (OperationToObservableFuture .toObservableFuture (future ));
2002
2003
}
2003
2004
2005
+ /**
2006
+ * Converts an Future to an Observable sequence.
2007
+ *
2008
+ * Any object that supports the {@link Future} interface can be converted into an Observable that emits
2009
+ * the return value of the get() method in the object, by passing the object into the <code>toObservable</code> method.
2010
+ * <p>
2011
+ * This is blocking so the Subscription returned when calling {@link #subscribe(Observer)} does nothing.
2012
+ *
2013
+ * @param future
2014
+ * the source {@link Future}
2015
+ * @param <T>
2016
+ * the type of of object that the future's returns and the type emitted by the resulting
2017
+ * Observable
2018
+ * @return an Observable that emits the item from the source Future
2019
+ */
2020
+ public static <T > Observable <T > from (Future <T > future ) {
2021
+ return create (OperationToObservableFuture .toObservableFuture (future ));
2022
+ }
2023
+
2004
2024
/**
2005
2025
* Converts an Future to an Observable sequence.
2006
2026
*
@@ -2020,11 +2040,36 @@ public static <T> Observable<T> toObservable(Future<T> future) {
2020
2040
* the type of of object that the future's returns and the type emitted by the resulting
2021
2041
* Observable
2022
2042
* @return an Observable that emits the item from the source Future
2043
+ * @deprecated Replaced by {@link #from(Future, long, TimeUnit)}
2023
2044
*/
2024
2045
public static <T > Observable <T > toObservable (Future <T > future , long timeout , TimeUnit unit ) {
2025
2046
return create (OperationToObservableFuture .toObservableFuture (future , timeout , unit ));
2026
2047
}
2027
2048
2049
+ /**
2050
+ * Converts an Future to an Observable sequence.
2051
+ *
2052
+ * Any object that supports the {@link Future} interface can be converted into an Observable that emits
2053
+ * the return value of the get() method in the object, by passing the object into the <code>toObservable</code> method.
2054
+ * The subscribe method on this synchronously so the Subscription returned doesn't nothing.
2055
+ * <p>
2056
+ * This is blocking so the Subscription returned when calling {@link #subscribe(Observer)} does nothing.
2057
+ *
2058
+ * @param future
2059
+ * the source {@link Future}
2060
+ * @param timeout
2061
+ * the maximum time to wait
2062
+ * @param unit
2063
+ * the time unit of the time argument
2064
+ * @param <T>
2065
+ * the type of of object that the future's returns and the type emitted by the resulting
2066
+ * Observable
2067
+ * @return an Observable that emits the item from the source Future
2068
+ */
2069
+ public static <T > Observable <T > from (Future <T > future , long timeout , TimeUnit unit ) {
2070
+ return create (OperationToObservableFuture .toObservableFuture (future , timeout , unit ));
2071
+ }
2072
+
2028
2073
/**
2029
2074
* Converts an Array sequence to an Observable sequence.
2030
2075
*
@@ -2039,6 +2084,7 @@ public static <T> Observable<T> toObservable(Future<T> future, long timeout, Tim
2039
2084
* the type of items in the Array, and the type of items emitted by the resulting
2040
2085
* Observable
2041
2086
* @return an Observable that emits each item in the source Array
2087
+ * @deprecated Use {@link #from(Object...)}
2042
2088
*/
2043
2089
public static <T > Observable <T > toObservable (T ... items ) {
2044
2090
return toObservable (Arrays .asList (items ));
0 commit comments