본문

180205(월) - RxJava2 (start)

RxJava2


start


create an Observable that emits the return value of a function-like directive

Start

There are a number of ways that programming languages have for obtaining values as the result of calculations, with names like functions, futures, actions, callables, runnables, and so forth. The operators grouped here under the Start operator category make these things behave like Observables so that they can be chained with other Observables in an Observable cascade



fromCallable

@CheckReturnValue
 @BackpressureSupport(value=FULL)
 @SchedulerSupport(value="none")
public static <T> Flowable<T> fromCallable(java.util.concurrent.Callable<? extends T> supplier)
Returns a Flowable that, when a Subscriber subscribes to it, invokes a function you specify and then emits the value returned from that function.

This allows you to defer the execution of the function you specify until a Subscriber subscribes to the Publisher. That is to say, it makes the function "lazy."

Backpressure:
The operator honors backpressure from downstream.
Scheduler:
fromCallable does not operate by default on a particular Scheduler.
Type Parameters:
T - the type of the item emitted by the Publisher
Parameters:
supplier - a function, the execution of which should be deferred; fromCallable will invoke this function only when a Subscriber subscribes to the Publisher that fromCallable returns
Returns:
a Flowable whose Subscribers' subscriptions trigger an invocation of the given function
Since:
2.0
See Also:
defer(Callable)


'Mobile > RxJava2' 카테고리의 다른 글

180107(수) - RxJava2 (buffer)  (0) 2018.02.07
180206(화) - RxJava2 (timer)  (0) 2018.02.06
180104(목) - RxJava2 (repeat)  (0) 2018.01.04
180103(수) - RxJava2 (range)  (0) 2018.01.03
180102(화) - RxJava2 (Just)  (0) 2018.01.02

공유

댓글