class FutureUtils {

	public static <IN> CompletableFuture<Void> thenAcceptAsyncIfNotDone(
		CompletableFuture<IN> completableFuture,
		Executor executor,
		Consumer<? super IN> consumer) {
		return completableFuture.isDone() ?
			completableFuture.thenAccept(consumer) :
			completableFuture.thenAcceptAsync(consumer, executor);
	}

}