I am reviewing the operator .thenCombine from CompletableFuture, but I have some issues when I try to combine more than 2 CompletableFuture objects.
Example:
CompletableFuture<List<String>> completableFuture =
CompletableFuture.supplyAsync(() -> fetch.andThen(log).apply(url1))
.thenCombine(CompletableFuture.supplyAsync(() -> fetch.andThen(log).apply(url2)),
//.thenCombine(CompletableFuture.supplyAsync(() -> fetch.andThen(log).apply(url3)),
(s1, s2) -> List.of(s1,s2));
//(s1, s2, s3) -> List.of(s1, s2, s3));
When I try to add the third CompletableFuture, I receive an Error in IntelliJ.
Any feedback?
Many thanks in advance
Juan Antonio