Skip to content

Commit

Permalink
Use new List#toArray method
Browse files Browse the repository at this point in the history
  • Loading branch information
pivovarit committed Oct 3, 2023
1 parent 5220c26 commit 3019b84
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.pivovarit.collectors;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -79,9 +78,8 @@ public Set<Characteristics> characteristics() {
}

private static <T> CompletableFuture<Stream<T>> combine(List<CompletableFuture<T>> futures) {
CompletableFuture<T>[] futuresArray = (CompletableFuture<T>[]) futures.toArray(new CompletableFuture[0]);
CompletableFuture<Stream<T>> combined = allOf(futuresArray)
.thenApply(__ -> Arrays.stream(futuresArray).map(CompletableFuture::join));
var futuresArray = futures.toArray(CompletableFuture[]::new);
var combined = allOf(futuresArray).thenApply(__ -> futures.stream().map(CompletableFuture::join));

for (CompletableFuture<?> f : futuresArray) {
f.exceptionally(ex -> {
Expand Down

0 comments on commit 3019b84

Please sign in to comment.