diff --git a/src/main/java/rx/Observable.java b/src/main/java/rx/Observable.java index 919548fd32..04a05bdea4 100644 --- a/src/main/java/rx/Observable.java +++ b/src/main/java/rx/Observable.java @@ -8603,6 +8603,26 @@ public final BlockingObservable toBlocking() { return BlockingObservable.from(this); } + /** + * Calls the specified converter function with the current Observable and returns + * its result. + *

+ * The method can be used for converting the current Observable into some other + * type in a fluent way, for example: + *

+     * Promise promise = someObservableOfT.to(RxRatpack::asPromise).onError(logger::error);
+     * 
+ * + * @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 to(final Func1, ? 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.