This is my stream:
Stream<CompletableFuture<String>> futureStream = IntStream
.iterate(1, n -> n < resultSet.getTotalCount() / pageSize, n -> n++)
.mapToObj(pageNumber -> this.buildCompletableFutureofResultSetType(oid, pageNumber, pageSize));
CompletableFuture has a allOf:
public static CompletableFuture<Object> allOf(CompletableFuture<?>... cfs);
I've took a look on allOf method code:
public static CompletableFuture<Void> allOf(CompletableFuture<?>... cfs) {
return andTree(cfs, 0, cfs.length - 1);
}
I know I can first collect all of them in a List<CompletableFuture> and then pass it to allOf.
However, I'd like to chain this collector process into stream functional chain.
Any ideas?