Код: Выделить всё
final List completableFutures = resolvers.stream()
.map(resolver -> supplyAsync(() -> task.doWork()))
.collect(toList());
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[completableFutures.size()])).join();
final List tests = new ArrayList();
completableFutures.stream()
.map(completableFuture -> completableFuture.getNow())
.forEach(tests::addAll);
Код: Выделить всё
final List completableFutures = resolvers.stream()
.map(resolver -> supplyAsync(() -> task.doWork()))
.collect(toList());
final List tests = new ArrayList();
completableFutures.stream()
.map(completableFuture -> completableFuture.join())
.forEach(tests::addAll);
Подробнее здесь: https://stackoverflow.com/questions/523 ... uture-join
Мобильная версия