Skip to content

Commit

Permalink
enhance Observable.fromCallable javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMGross committed Oct 12, 2015
1 parent aef6b96 commit f9d3e99
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -1251,22 +1251,26 @@ public final static <T> Observable<T> from(T[] array) {
}

/**
* Returns an Observable that invokes passed function and emits its result for each new Observer that subscribes.
* Returns an Observable that, when an observer subscribes to it, invokes a function you specify and then
* emits the value returned from that function.
* <p>
* Allows you to defer execution of passed function until Observer subscribes to the Observable.
* It makes passed function "lazy".
* Result of the function invocation will be emitted by the Observable.
* <img width="640" height="195" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.png" alt="">
* <p>
* This allows you to defer the execution of the function you specify untl an observer subscribes to the
* Observable. That is to say, it makes the function "lazy."
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param func
* function which execution should be deferred, it will be invoked when Observer will subscribe to the Observable
* a function, the execution of which should be deferred; {@code fromCallable} will invoke this
* function only when an observer subscribes to the Observable that {@code fromCallable} returns
* @param <T>
* the type of the item emitted by the Observable
* @return an Observable whose {@link Observer}s' subscriptions trigger an invocation of the given function
* @see #defer(Func0)
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public static <T> Observable<T> fromCallable(Callable<? extends T> func) {
Expand Down

0 comments on commit f9d3e99

Please sign in to comment.