(
final ModLoadingStage.EventGenerator<T> eventGenerator,
final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChange)
| 122 | } |
| 123 | |
| 124 | <T extends Event & IModBusEvent> Function<Executor, CompletableFuture<List<Throwable>>> futureVisitor( |
| 125 | final ModLoadingStage.EventGenerator<T> eventGenerator, |
| 126 | final BiFunction<ModLoadingStage, Throwable, ModLoadingStage> stateChange) { |
| 127 | return executor -> gather( |
| 128 | this.mods.stream() |
| 129 | .map(mod -> ModContainer.buildTransitionHandler(mod, eventGenerator, stateChange, executor)) |
| 130 | .collect(Collectors.toList())) |
| 131 | .thenComposeAsync(ModList::completableFutureFromExceptionList, executor); |
| 132 | } |
| 133 | static CompletionStage<List<Throwable>> completableFutureFromExceptionList(List<? extends Map.Entry<?, Throwable>> t) { |
| 134 | if (t.stream().noneMatch(e->e.getValue()!=null)) { |
| 135 | return CompletableFuture.completedFuture(Collections.emptyList()); |
no test coverage detected