class DeferredResult {

    public static DeferredResult<Void> allOf(DeferredResult<?>... deferredResults) {
        CompletableFuture<?>[] cfs = Arrays.stream(deferredResults)
                .map(d -> d.completableFuture)
                .collect(Collectors.toList())
                .toArray(new CompletableFuture<?>[deferredResults.length]);
        CompletableFuture<Void> cf = CompletableFuture.allOf(cfs);
        return new DeferredResult<>(cf);
    }

    public  DeferredResult();
    public  DeferredResult(CompletableFuture<T> completableFuture);

}