Skip to content

Commit 2c9e1d3

Browse files
committed
Presize list in sequence()
1 parent b5fe5c7 commit 2c9e1d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

graphql-java-kickstart/src/main/java/graphql/kickstart/execution/GraphQLInvoker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private CompletableFuture<List<ExecutionResult>> executeAsync(GraphQLBatchedInvo
5151
private <T> CompletableFuture<List<T>> sequence(List<CompletableFuture<T>> futures) {
5252
CompletableFuture[] futuresArray = futures.toArray(new CompletableFuture[0]);
5353
return CompletableFuture.allOf(futuresArray).thenApply(aVoid -> {
54-
List<T> result = new ArrayList<>();
54+
List<T> result = new ArrayList<>(futures.size());
5555
for (CompletableFuture future : futuresArray) {
5656
assert future.isDone(); // per the API contract of allOf()
5757
result.add((T) future.join());

0 commit comments

Comments
 (0)