|
18 | 18 |
|
19 | 19 | import java.util.Collections; |
20 | 20 | import java.util.HashMap; |
| 21 | +import java.util.HashSet; |
21 | 22 | import java.util.LinkedHashMap; |
22 | 23 | import java.util.List; |
23 | 24 | import java.util.Map; |
24 | 25 | import java.util.Set; |
25 | 26 | import java.util.concurrent.CompletableFuture; |
26 | 27 | import java.util.function.BiFunction; |
27 | 28 | import java.util.function.Supplier; |
28 | | -import java.util.stream.Collectors; |
29 | 29 |
|
30 | 30 | /** |
31 | 31 | * The purpose of this class hierarchy is to encapsulate most of the logic for deferring field execution, thus |
@@ -107,19 +107,23 @@ public List<String> getNonDeferredFieldNames(List<String> allFieldNames) { |
107 | 107 |
|
108 | 108 | @Override |
109 | 109 | public Set<IncrementalCall<? extends IncrementalPayload>> createCalls(ExecutionStrategyParameters executionStrategyParameters) { |
110 | | - return deferredExecutionToFields.keySet().stream() |
111 | | - .map(deferredExecution -> this.createDeferredFragmentCall(deferredExecution, executionStrategyParameters)) |
112 | | - .collect(Collectors.toSet()); |
| 110 | + ImmutableSet<DeferredExecution> deferredExecutions = deferredExecutionToFields.keySet(); |
| 111 | + Set<IncrementalCall<? extends IncrementalPayload>> set = new HashSet<>(deferredExecutions.size()); |
| 112 | + for (DeferredExecution deferredExecution : deferredExecutions) { |
| 113 | + set.add(this.createDeferredFragmentCall(deferredExecution, executionStrategyParameters)); |
| 114 | + } |
| 115 | + return set; |
113 | 116 | } |
114 | 117 |
|
115 | 118 | private DeferredFragmentCall createDeferredFragmentCall(DeferredExecution deferredExecution, ExecutionStrategyParameters executionStrategyParameters) { |
116 | 119 | DeferredCallContext deferredCallContext = new DeferredCallContext(); |
117 | 120 |
|
118 | 121 | List<MergedField> mergedFields = deferredExecutionToFields.get(deferredExecution); |
119 | 122 |
|
120 | | - List<Supplier<CompletableFuture<DeferredFragmentCall.FieldWithExecutionResult>>> calls = mergedFields.stream() |
121 | | - .map(currentField -> this.createResultSupplier(currentField, deferredCallContext, executionStrategyParameters)) |
122 | | - .collect(Collectors.toList()); |
| 123 | + List<Supplier<CompletableFuture<DeferredFragmentCall.FieldWithExecutionResult>>> calls = FpKit.arrayListSizedTo(mergedFields); |
| 124 | + for (MergedField currentField : mergedFields) { |
| 125 | + calls.add(this.createResultSupplier(currentField, deferredCallContext, executionStrategyParameters)); |
| 126 | + } |
123 | 127 |
|
124 | 128 | return new DeferredFragmentCall( |
125 | 129 | deferredExecution.getLabel(), |
|
0 commit comments