public static <T> CompletableFuture<List<T>> collectFrom(Stream<T> stream, Executor executor) {
        requireNonNull(stream, "stream");
        requireNonNull(executor, "executor");
        final CompletableFuture<List<T>> future = new CompletableFuture<>();
        executor.execute(() -> {
            try {
                future.complete(stream.collect(toImmutableList()));
            } catch (Exception e) {
                future.completeExceptionally(e);
            }
        });
        return future;
    }
Collects objects published from the specified {@link Stream}.

@param stream publishes objects
@param executor executes the collecting job
@return a {@link CompletableFuture} which will complete when all published objects are collected
core/src/main/java/com/linecorp/armeria/internal/common/util/ObjectCollectingUtil.java