void (@NotNull YAMLValue value, @NotNull ProblemsHolder problemsHolder) { List<YamlMetaType> types; if (value instanceof YAMLScalar) { types = listScalarSubTypes(); if (types.isEmpty()) { // value kind does not match, let some scalar component to report it types = Collections.singletonList(listNonScalarSubTypes().get(0)); } } else { types = listNonScalarSubTypes(); if (types.isEmpty()) { // only scalar components, let one of them report it types = Collections.singletonList(listScalarSubTypes().get(0)); } } List<ProblemsHolder> allProblems = allProblemsOrEmpty(problemsHolder, types, (nextType, nextHolder) -> nextType.validateValue(value, nextHolder)); allProblems.stream() .flatMap(h -> h.getResults().stream()) .forEach(problemsHolder::registerProblem); }