Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/main/java/rx/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -8603,6 +8603,26 @@ public final BlockingObservable<T> toBlocking() {
return BlockingObservable.from(this);
}

/**
* Calls the specified converter function with the current Observable and returns
* its result.
* <p>
* The method can be used for converting the current Observable into some other
* type in a fluent way, for example:
* <pre>
* Promise<T> promise = someObservableOfT.to(RxRatpack::asPromise).onError(logger::error);
* </pre>
*
* @param converter the function that converts the current observable to some other type
* @return the result of the converter function.
* @Experimental The behavior of this can change at any time.
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
*/
@Experimental
public final <O> O to(final Func1<? super Observable<T>, ? extends O> converter) {
return converter.call(this);
}

/**
* Returns an Observable that emits a single item, a list composed of all the items emitted by the source
* Observable.
Expand Down