All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hedera.hashgraph.sdk.ConsumerHelper Maven / Gradle / Ivy

package com.hedera.hashgraph.sdk;


import java8.util.concurrent.CompletableFuture;
import java8.util.function.BiConsumer;
import java8.util.function.Consumer;


class ConsumerHelper {
    static  void biConsumer(CompletableFuture future, BiConsumer consumer) {
        future.whenComplete(consumer);
    }

    static  void twoConsumers(CompletableFuture future, Consumer onSuccess, Consumer onFailure) {
        future.whenComplete((output, error) -> {
            if (error != null) {
                onFailure.accept(error);
            } else {
                onSuccess.accept(output);
            }
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy