class FutureUtils {

    public static <T> CompletableFuture<Optional<T>> optionalFuture(CompletableFuture<? extends T> future) {
        CompletableFuture<Optional<T>> optFuture = future.thenApply(Optional::of);
        return wrapFutureForConditionalFallback(optFuture,
                FutureUtils::resourceNotFound,
                () -> CompletableFuture.completedFuture(Optional.empty()));
    }

    private  FutureUtils();

}