Class AsyncObservable


  • public final class AsyncObservable
    extends java.lang.Object
    Utility methods to convert functions and actions into asynchronous operations through the Observable/Observer pattern.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> Observable<T> deferFuture​(Supplier<? extends java.util.concurrent.Future<? extends ObservableSource<? extends T>>> publisherFactoryAsync)
      Returns an Observable that starts the specified asynchronous factory function whenever a new subscriber subscribes.
      static <T> Observable<T> deferFuture​(Supplier<? extends java.util.concurrent.Future<? extends ObservableSource<? extends T>>> publisherFactoryAsync, Scheduler scheduler)
      Returns an Observable that starts the specified asynchronous factory function whenever a new subscriber subscribes.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext, Scheduler scheduler)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given scheduler.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Scheduler scheduler)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given Scheduler.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.
      static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source, Consumer<? super T> onNext, Consumer<? super java.lang.Throwable> onError, Action onComplete, Scheduler scheduler)
      Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given Scheduler.
      static <T> DisposableObservable<T> runAsync​(Scheduler scheduler, BiConsumer<? super Observer<? super T>,​? super Disposable> action)
      Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned DisposableObservable.
      static <T> DisposableObservable<T> runAsync​(Scheduler scheduler, Subject<T> subject, BiConsumer<? super Observer<? super T>,​? super Disposable> action)
      Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned DisposableObservable.
      static <T> Observable<T> start​(Supplier<? extends T> func)
      Invokes the specified function asynchronously and returns an Observable that emits the result.
      static <T> Observable<T> start​(Supplier<? extends T> func, Scheduler scheduler)
      Invokes the specified function asynchronously on the specified Scheduler and returns an Observable that emits the result.
      static <T> Observable<T> startFuture​(Supplier<? extends java.util.concurrent.Future<? extends T>> functionAsync)
      Invokes the asynchronous function immediately, surfacing the result through an Observable.
      static <T> Observable<T> startFuture​(Supplier<? extends java.util.concurrent.Future<? extends T>> functionAsync, Scheduler scheduler)
      Invokes the asynchronous function immediately, surfacing the result through an Observable and waits on the specified Scheduler.
      static <T1,​T2,​T3>
      PlainFunction3<T1,​T2,​T3,​Observable<java.lang.Object>>
      toAsync​(Consumer3<? super T1,​? super T2,​? super T3> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3>
      PlainFunction3<T1,​T2,​T3,​Observable<java.lang.Object>>
      toAsync​(Consumer3<? super T1,​? super T2,​? super T3> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4>
      PlainFunction4<T1,​T2,​T3,​T4,​Observable<java.lang.Object>>
      toAsync​(Consumer4<? super T1,​? super T2,​? super T3,​? super T4> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4>
      PlainFunction4<T1,​T2,​T3,​T4,​Observable<java.lang.Object>>
      toAsync​(Consumer4<? super T1,​? super T2,​? super T3,​? super T4> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5>
      PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<java.lang.Object>>
      toAsync​(Consumer5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5>
      PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<java.lang.Object>>
      toAsync​(Consumer5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6>
      PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<java.lang.Object>>
      toAsync​(Consumer6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6>
      PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<java.lang.Object>>
      toAsync​(Consumer6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7>
      PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<java.lang.Object>>
      toAsync​(Consumer7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7>
      PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<java.lang.Object>>
      toAsync​(Consumer7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
      PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<java.lang.Object>>
      toAsync​(Consumer8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
      PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<java.lang.Object>>
      toAsync​(Consumer8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>
      PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<java.lang.Object>>
      toAsync​(Consumer9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>
      PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<java.lang.Object>>
      toAsync​(Consumer9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static SimpleCallable<Observable<java.lang.Object>> toAsync​(Action action)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static SimpleCallable<Observable<java.lang.Object>> toAsync​(Action action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static <T1,​T2>
      PlainBiFunction<T1,​T2,​Observable<java.lang.Object>>
      toAsync​(BiConsumer<? super T1,​? super T2> action)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static <T1,​T2>
      PlainBiFunction<T1,​T2,​Observable<java.lang.Object>>
      toAsync​(BiConsumer<? super T1,​? super T2> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static <T1,​T2,​R>
      PlainBiFunction<T1,​T2,​Observable<R>>
      toAsync​(BiFunction<? super T1,​? super T2,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <T1,​T2,​R>
      PlainBiFunction<T1,​T2,​Observable<R>>
      toAsync​(BiFunction<? super T1,​? super T2,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <T1> PlainFunction<T1,​Observable<java.lang.Object>> toAsync​(Consumer<? super T1> action)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static <T1> PlainFunction<T1,​Observable<java.lang.Object>> toAsync​(Consumer<? super T1> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through a Observable.
      static <T1,​R>
      PlainFunction<T1,​Observable<R>>
      toAsync​(Function<? super T1,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <T1,​R>
      PlainFunction<T1,​Observable<R>>
      toAsync​(Function<? super T1,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <T1,​T2,​T3,​R>
      PlainFunction3<T1,​T2,​T3,​Observable<R>>
      toAsync​(Function3<? super T1,​? super T2,​? super T3,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​R>
      PlainFunction3<T1,​T2,​T3,​Observable<R>>
      toAsync​(Function3<? super T1,​? super T2,​? super T3,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​R>
      PlainFunction4<T1,​T2,​T3,​T4,​Observable<R>>
      toAsync​(Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​R>
      PlainFunction4<T1,​T2,​T3,​T4,​Observable<R>>
      toAsync​(Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​R>
      PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<R>>
      toAsync​(Function5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​R>
      PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<R>>
      toAsync​(Function5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​R>
      PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<R>>
      toAsync​(Function6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​R>
      PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<R>>
      toAsync​(Function6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R>
      PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<R>>
      toAsync​(Function7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R>
      PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<R>>
      toAsync​(Function7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R>
      PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<R>>
      toAsync​(Function8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R>
      PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<R>>
      toAsync​(Function8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R>
      PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<R>>
      toAsync​(Function9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9,​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R>
      PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<R>>
      toAsync​(Function9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9,​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static PlainFunction<java.lang.Object[],​Observable<java.lang.Object>> toAsyncArray​(Consumer<? super java.lang.Object[]> action)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static PlainFunction<java.lang.Object[],​Observable<java.lang.Object>> toAsyncArray​(Consumer<? super java.lang.Object[]> action, Scheduler scheduler)
      Convert a synchronous action call into an asynchronous function call through an Observable.
      static <R> PlainFunction<java.lang.Object[],​Observable<R>> toAsyncArray​(Function<? super java.lang.Object[],​? extends R> func)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <R> PlainFunction<java.lang.Object[],​Observable<R>> toAsyncArray​(Function<? super java.lang.Object[],​? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through an Observable.
      static <R> SimpleCallable<Observable<R>> toAsyncCallable​(java.util.concurrent.Callable<? extends R> func)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <R> SimpleCallable<Observable<R>> toAsyncCallable​(java.util.concurrent.Callable<? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <R> SimpleCallable<Observable<R>> toAsyncSupplier​(Supplier<? extends R> func)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      static <R> SimpleCallable<Observable<R>> toAsyncSupplier​(Supplier<? extends R> func, Scheduler scheduler)
      Convert a synchronous function call into an asynchronous function call through a Observable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • start

        public static <T> Observable<T> start​(Supplier<? extends T> func)
        Invokes the specified function asynchronously and returns an Observable that emits the result.

        Note: The function is called immediately and once, not whenever an observer subscribes to the resulting Observable. Multiple subscriptions to this Observable observe the same return value.

        Scheduler:
        start by default operates on the computation Scheduler.
        Type Parameters:
        T - the result value type
        Parameters:
        func - function to run asynchronously
        Returns:
        an Observable that emits the function's result value, or notifies observers of an exception
        See Also:
        RxJava Wiki: start(), MSDN: Observable.Start
      • start

        public static <T> Observable<T> start​(Supplier<? extends T> func,
                                              Scheduler scheduler)
        Invokes the specified function asynchronously on the specified Scheduler and returns an Observable that emits the result.

        Note: The function is called immediately and once, not whenever an observer subscribes to the resulting Observable. Multiple subscriptions to this Observable observe the same return value.

        Scheduler:
        You specify the Scheduler start works on.

        Type Parameters:
        T - the result value type
        Parameters:
        func - function to run asynchronously
        scheduler - Scheduler to run the function on
        Returns:
        an Observable that emits the function's result value, or notifies observers of an exception
        See Also:
        RxJava Wiki: start(), MSDN: Observable.Start
      • toAsync

        public static SimpleCallable<Observable<java.lang.Object>> toAsync​(Action action)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncCallable

        public static <R> SimpleCallable<Observable<R>> toAsyncCallable​(java.util.concurrent.Callable<? extends R> func)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        toAsyncCallable by default operates on the computation Scheduler.
        Type Parameters:
        R - the result value type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncSupplier

        public static <R> SimpleCallable<Observable<R>> toAsyncSupplier​(Supplier<? extends R> func)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        toAsyncSupplier by default operates on the computation Scheduler.
        Type Parameters:
        R - the result value type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1> PlainFunction<T1,​Observable<java.lang.Object>> toAsync​(Consumer<? super T1> action)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - first parameter type of the action
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​R> PlainFunction<T1,​Observable<R>> toAsync​(Function<? super T1,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - first parameter type of the action
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2> PlainBiFunction<T1,​T2,​Observable<java.lang.Object>> toAsync​(BiConsumer<? super T1,​? super T2> action)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns a Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​R> PlainBiFunction<T1,​T2,​Observable<R>> toAsync​(BiFunction<? super T1,​? super T2,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns a Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3> PlainFunction3<T1,​T2,​T3,​Observable<java.lang.Object>> toAsync​(Consumer3<? super T1,​? super T2,​? super T3> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​R> PlainFunction3<T1,​T2,​T3,​Observable<R>> toAsync​(Function3<? super T1,​? super T2,​? super T3,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4> PlainFunction4<T1,​T2,​T3,​T4,​Observable<java.lang.Object>> toAsync​(Consumer4<? super T1,​? super T2,​? super T3,​? super T4> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​R> PlainFunction4<T1,​T2,​T3,​T4,​Observable<R>> toAsync​(Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5> PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<java.lang.Object>> toAsync​(Consumer5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​R> PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<R>> toAsync​(Function5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6> PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<java.lang.Object>> toAsync​(Consumer6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​R> PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<R>> toAsync​(Function6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7> PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<java.lang.Object>> toAsync​(Consumer7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R> PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<R>> toAsync​(Function7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<java.lang.Object>> toAsync​(Consumer8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R> PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<R>> toAsync​(Function8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<java.lang.Object>> toAsync​(Consumer9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        T9 - the ninth parameter type
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R> PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<R>> toAsync​(Function9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9,​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsync by default operates on the computation Scheduler.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        T9 - the ninth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncArray

        public static PlainFunction<java.lang.Object[],​Observable<java.lang.Object>> toAsyncArray​(Consumer<? super java.lang.Object[]> action)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        toAsyncArray by default operates on the computation Scheduler.
        Parameters:
        action - the action to convert
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync()
      • toAsyncArray

        public static <R> PlainFunction<java.lang.Object[],​Observable<R>> toAsyncArray​(Function<? super java.lang.Object[],​? extends R> func)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        toAsyncArray by default operates on the computation Scheduler.
        Type Parameters:
        R - the result type
        Parameters:
        func - the function to convert
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync()
      • toAsync

        public static SimpleCallable<Observable<java.lang.Object>> toAsync​(Action action,
                                                                           Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits an Object
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncCallable

        public static <R> SimpleCallable<Observable<R>> toAsyncCallable​(java.util.concurrent.Callable<? extends R> func,
                                                                        Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsyncCallable works on.
        Type Parameters:
        R - the result value type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncSupplier

        public static <R> SimpleCallable<Observable<R>> toAsyncSupplier​(Supplier<? extends R> func,
                                                                        Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsyncSupplier works on.
        Type Parameters:
        R - the result value type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1> PlainFunction<T1,​Observable<java.lang.Object>> toAsync​(Consumer<? super T1> action,
                                                                                        Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - first parameter type of the action
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​R> PlainFunction<T1,​Observable<R>> toAsync​(Function<? super T1,​? extends R> func,
                                                                                 Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - first parameter type of the action
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2> PlainBiFunction<T1,​T2,​Observable<java.lang.Object>> toAsync​(BiConsumer<? super T1,​? super T2> action,
                                                                                                            Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns a Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​R> PlainBiFunction<T1,​T2,​Observable<R>> toAsync​(BiFunction<? super T1,​? super T2,​? extends R> func,
                                                                                                     Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through a Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns a Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3> PlainFunction3<T1,​T2,​T3,​Observable<java.lang.Object>> toAsync​(Consumer3<? super T1,​? super T2,​? super T3> action,
                                                                                                                             Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​R> PlainFunction3<T1,​T2,​T3,​Observable<R>> toAsync​(Function3<? super T1,​? super T2,​? super T3,​? extends R> func,
                                                                                                                      Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4> PlainFunction4<T1,​T2,​T3,​T4,​Observable<java.lang.Object>> toAsync​(Consumer4<? super T1,​? super T2,​? super T3,​? super T4> action,
                                                                                                                                               Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​R> PlainFunction4<T1,​T2,​T3,​T4,​Observable<R>> toAsync​(Function4<? super T1,​? super T2,​? super T3,​? super T4,​? extends R> func,
                                                                                                                                        Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5> PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<java.lang.Object>> toAsync​(Consumer5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5> action,
                                                                                                                                                                 Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​R> PlainFunction5<T1,​T2,​T3,​T4,​T5,​Observable<R>> toAsync​(Function5<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? extends R> func,
                                                                                                                                                          Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6> PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<java.lang.Object>> toAsync​(Consumer6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6> action,
                                                                                                                                                                                   Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​R> PlainFunction6<T1,​T2,​T3,​T4,​T5,​T6,​Observable<R>> toAsync​(Function6<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? extends R> func,
                                                                                                                                                                            Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7> PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<java.lang.Object>> toAsync​(Consumer7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7> action,
                                                                                                                                                                                                     Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R> PlainFunction7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​Observable<R>> toAsync​(Function7<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? extends R> func,
                                                                                                                                                                                              Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<java.lang.Object>> toAsync​(Consumer8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8> action,
                                                                                                                                                                                                                       Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R> PlainFunction8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​Observable<R>> toAsync​(Function8<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? extends R> func,
                                                                                                                                                                                                                Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<java.lang.Object>> toAsync​(Consumer9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9> action,
                                                                                                                                                                                                                                         Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        T9 - the ninth parameter type
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsync

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R> PlainFunction9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​Observable<R>> toAsync​(Function9<? super T1,​? super T2,​? super T3,​? super T4,​? super T5,​? super T6,​? super T7,​? super T8,​? super T9,​? extends R> func,
                                                                                                                                                                                                                                  Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        T1 - the first parameter type
        T2 - the second parameter type
        T3 - the third parameter type
        T4 - the fourth parameter type
        T5 - the fifth parameter type
        T6 - the sixth parameter type
        T7 - the seventh parameter type
        T8 - the eighth parameter type
        T9 - the ninth parameter type
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync(), MSDN: Observable.ToAsync
      • toAsyncArray

        public static PlainFunction<java.lang.Object[],​Observable<java.lang.Object>> toAsyncArray​(Consumer<? super java.lang.Object[]> action,
                                                                                                        Scheduler scheduler)
        Convert a synchronous action call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Parameters:
        action - the action to convert
        scheduler - the Scheduler used to execute the action
        Returns:
        a function that returns an Observable that executes the action and emits null
        See Also:
        RxJava Wiki: toAsync()
      • toAsyncArray

        public static <R> PlainFunction<java.lang.Object[],​Observable<R>> toAsyncArray​(Function<? super java.lang.Object[],​? extends R> func,
                                                                                             Scheduler scheduler)
        Convert a synchronous function call into an asynchronous function call through an Observable.

        Scheduler:
        You specify the Scheduler toAsync works on.
        Type Parameters:
        R - the result type
        Parameters:
        func - the function to convert
        scheduler - the Scheduler used to call the func
        Returns:
        a function that returns an Observable that executes the func and emits its returned value
        See Also:
        RxJava Wiki: toAsync()
      • startFuture

        public static <T> Observable<T> startFuture​(Supplier<? extends java.util.concurrent.Future<? extends T>> functionAsync)
        Invokes the asynchronous function immediately, surfacing the result through an Observable.

        Important note subscribing to the resulting Observable blocks until the future completes.

        Scheduler:
        startFuture by default operates on the computation Scheduler.
        Type Parameters:
        T - the result type
        Parameters:
        functionAsync - the asynchronous function to run
        Returns:
        an Observable that surfaces the result of the future
        See Also:
        startFuture(Supplier, Scheduler), RxJava Wiki: startFuture()
      • startFuture

        public static <T> Observable<T> startFuture​(Supplier<? extends java.util.concurrent.Future<? extends T>> functionAsync,
                                                    Scheduler scheduler)
        Invokes the asynchronous function immediately, surfacing the result through an Observable and waits on the specified Scheduler.

        Scheduler:
        You specify the Scheduler startFuture works on.
        Type Parameters:
        T - the result type
        Parameters:
        functionAsync - the asynchronous function to run
        scheduler - the Scheduler where the completion of the Future is awaited
        Returns:
        an Observable that surfaces the result of the future
        See Also:
        RxJava Wiki: startFuture()
      • deferFuture

        public static <T> Observable<T> deferFuture​(Supplier<? extends java.util.concurrent.Future<? extends ObservableSource<? extends T>>> publisherFactoryAsync)
        Returns an Observable that starts the specified asynchronous factory function whenever a new subscriber subscribes.

        Important note subscribing to the resulting Observable blocks until the future completes.

        Scheduler:
        deferFuture by default operates on the computation Scheduler.
        Type Parameters:
        T - the result type
        Parameters:
        publisherFactoryAsync - the asynchronous function to start for each observer
        Returns:
        the Observable emitting items produced by the asynchronous observer produced by the factory
        See Also:
        deferFuture(Supplier, Scheduler), RxJava Wiki: deferFuture()
      • deferFuture

        public static <T> Observable<T> deferFuture​(Supplier<? extends java.util.concurrent.Future<? extends ObservableSource<? extends T>>> publisherFactoryAsync,
                                                    Scheduler scheduler)
        Returns an Observable that starts the specified asynchronous factory function whenever a new subscriber subscribes.

        Scheduler:
        You specify the Scheduler deferFuture works on.
        Type Parameters:
        T - the result type
        Parameters:
        publisherFactoryAsync - the asynchronous function to start for each observer
        scheduler - the Scheduler where the completion of the Future is awaited
        Returns:
        the Observable emitting items produced by the asynchronous observer produced by the factory
        See Also:
        RxJava Wiki: deferFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.

        Important note: The returned task blocks indefinitely unless the run() method is called or the task is scheduled on an Executor.

        Scheduler:
        forEachFuture by default operates on the computation Scheduler.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source ObservableSource
        onNext - the action to call with each emitted element
        Returns:
        the Future representing the entire for-each operation
        See Also:
        forEachFuture(ObservableSource, Consumer, Scheduler), RxJava Wiki: forEachFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext,
                                                                                      Consumer<? super java.lang.Throwable> onError)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.

        Important note: The returned task blocks indefinitely unless the run() method is called or the task is scheduled on an Executor.

        Scheduler:
        forEachFuture by default operates on the computation Scheduler.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source ObservableSource
        onNext - the action to call with each emitted element
        onError - the action to call when an exception is emitted
        Returns:
        the Future representing the entire for-each operation
        See Also:
        forEachFuture(ObservableSource, Consumer, Consumer, Scheduler), RxJava Wiki: forEachFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext,
                                                                                      Consumer<? super java.lang.Throwable> onError,
                                                                                      Action onComplete)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future.

        Important note: The returned task blocks indefinitely unless the run() method is called or the task is scheduled on an Executor.

        Scheduler:
        forEachFuture by default operates on the computation Scheduler.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source ObservableSource
        onNext - the action to call with each emitted element
        onError - the action to call when an exception is emitted
        onComplete - the action to call when the source completes
        Returns:
        the Future representing the entire for-each operation
        See Also:
        forEachFuture(ObservableSource, Consumer, Consumer, Action, Scheduler), RxJava Wiki: forEachFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext,
                                                                                      Scheduler scheduler)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given scheduler.

        Scheduler:
        You specify the Scheduler forEachFuture works on.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source Observable
        onNext - the action to call with each emitted element
        scheduler - the Scheduler where the task will await the termination of the for-each
        Returns:
        the Future representing the entire for-each operation
        See Also:
        RxJava Wiki: forEachFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext,
                                                                                      Consumer<? super java.lang.Throwable> onError,
                                                                                      Scheduler scheduler)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given Scheduler.

        Scheduler:
        You specify the Scheduler forEachFuture works on.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source ObservableSource
        onNext - the action to call with each emitted element
        onError - the action to call when an exception is emitted
        scheduler - the Scheduler where the task will await the termination of the for-each
        Returns:
        the Future representing the entire for-each operation
        See Also:
        RxJava Wiki: forEachFuture()
      • forEachFuture

        public static <T> java.util.concurrent.Future<java.lang.Object> forEachFuture​(ObservableSource<? extends T> source,
                                                                                      Consumer<? super T> onNext,
                                                                                      Consumer<? super java.lang.Throwable> onError,
                                                                                      Action onComplete,
                                                                                      Scheduler scheduler)
        Subscribes to the given source and calls the callback for each emitted item, and surfaces the completion or error through a Future, scheduled on the given Scheduler.

        Scheduler:
        You specify the Scheduler forEachFuture works on.
        Type Parameters:
        T - the source value type
        Parameters:
        source - the source Observable
        onNext - the action to call with each emitted element
        onError - the action to call when an exception is emitted
        onComplete - the action to call when the source completes
        scheduler - the Scheduler where the task will await the termination of the for-each
        Returns:
        the Future representing the entire for-each operation
        See Also:
        RxJava Wiki: forEachFuture()
      • runAsync

        public static <T> DisposableObservable<T> runAsync​(Scheduler scheduler,
                                                           BiConsumer<? super Observer<? super T>,​? super Disposable> action)
        Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned DisposableObservable. The action is immediately executed and unobserved values will be lost.
        Scheduler:
        You specify the Scheduler forEachFuture works on.
        Type Parameters:
        T - the output value type
        Parameters:
        scheduler - the Scheduler where the action is executed
        action - the action to execute, receives a Subscriber where the events can be pumped and a Disposable which lets it check for cancellation condition
        Returns:
        an DisposableObservable that provides a Disposable interface to cancel the action
        See Also:
        RxJava Wiki: runAsync()
      • runAsync

        public static <T> DisposableObservable<T> runAsync​(Scheduler scheduler,
                                                           Subject<T> subject,
                                                           BiConsumer<? super Observer<? super T>,​? super Disposable> action)
        Runs the provided action on the given scheduler and allows propagation of multiple events to the observers of the returned DisposableObservable. The action is immediately executed and unobserved values might be lost, depending on the Subject type used.
        Scheduler:
        You specify the Scheduler forEachFuture works on.
        Type Parameters:
        T - the output value of the action
        Parameters:
        scheduler - the Scheduler where the action is executed
        subject - the subject to use to distribute values emitted by the action
        action - the action to execute, receives a Subscriber where the events can be pumped and a Disposable which lets it check for cancellation condition
        Returns:
        an DisposableObservable that provides a Disposable interface to cancel the action
        See Also:
        RxJava Wiki: runAsync()