boolean (@NotNull String name, @NotNull List<String> branches, @NotNull List<Pattern> patterns) { if (branches.contains(name)) return true; for (Pattern regexp : patterns) { if (regexp.matcher(name).matches()) return true; } return false; }