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