Set<Tag> (@Nullable String referenceName) { if (referenceName == null) { return Collections.emptySet(); } String[] strings = NameUtilCore.nameToWords(referenceName); if (strings.length == 0) { return Collections.emptySet(); } Tag[] canBeFirst = getTags(strings[0]); Set<Tag> result = new HashSet<>(); for (Tag firstPart : canBeFirst) { StringJoiner joiner = new StringJoiner(""); joiner.add(firstPart.name); for (int i = 1; i < strings.length; i++) { String string = strings[i]; joiner.add(string); } result.add(new Tag(joiner.toString(), firstPart.matcher)); } return result; }