List<String> (@NotNull Matcher matcher) { final List<String> result = new ArrayList<>(); result.add(matcher.group(REQUIREMENT_GROUP)); final String requirementOptions = matcher.group(REQUIREMENT_OPTIONS_GROUP); if (requirementOptions != null) { Arrays.stream(requirementOptions.split(" ")) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(result::add); } return result; }