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);
	}
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 ) ; }
This function takes a {@link CompletableFuture} and a consumer to accept the result of this future. If the input
future is already done, this function returns {@link CompletableFuture#thenAccept(Consumer)}. Otherwise, the
return value is {@link CompletableFuture#thenAcceptAsync(Consumer, Executor)} with the given executor.

@param completableFuture the completable future for which we want to call #thenAccept.
@param executor the executor to run the thenAccept function if the future is not yet done.
@param consumer the consumer function to call when the future is completed.
@param <IN> type of the input future.
@return the new completion stage.