List<ProblemsHolder> (@NotNull ProblemsHolder problemsHolder, @NotNull List<YamlMetaType> types, @NotNull BiConsumer<YamlMetaType, ProblemsHolder> oneValidation) { List<ProblemsHolder> problems = new SmartList<>(); for (YamlMetaType nextType : types) { ProblemsHolder nextHolder = makeCopy(problemsHolder); oneValidation.accept(nextType, nextHolder); if (!nextHolder.hasResults()) { return Collections.emptyList(); } problems.add(nextHolder); } return problems; }