Java Code Examples for io.reactivex.Single#fromFuture()

The following examples show how to use io.reactivex.Single#fromFuture() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: cxf   File: RxJava2FlowableService.java    License: Apache License 2.0 5 votes vote down vote up
@GET
@Produces("application/json")
@Path("textJsonSingle")
public Single<HelloWorldBean> getJsonSingle() {
    CompletableFuture<HelloWorldBean> completableFuture = CompletableFuture
        .supplyAsync(() -> {
            sleep();
            return new HelloWorldBean("Hello");
        });
    return Single.fromFuture(completableFuture);
}
 
Example 2
Source Project: rxfirebase   File: RxFirebaseAuth.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@CheckReturnValue
public static Single<String> runTransaction(@Nonnull final FirebaseAuth firebaseAuth, @Nonnull final String uid) {
    return Single.fromFuture(firebaseAuth.createCustomTokenAsync(uid));
}
 
Example 3
Source Project: rxfirebase   File: RxFirestore.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@CheckReturnValue
public static <T> Single<T> runTransaction(@Nonnull final Firestore firestore, @Nonnull final Transaction.Function<T> updateFunction) {
    return Single.fromFuture(firestore.runTransaction(updateFunction));
}
 
Example 4
Source Project: rxfirebase   File: RxFirestore.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
@CheckReturnValue
public static Single<List<DocumentSnapshot>> getAll(@Nonnull final Firestore firestore, final DocumentReference... documentReferences) {
    return Single.fromFuture(firestore.getAll(documentReferences));
}