List<String> (String types) { List<String> result = new ArrayList<>(); int pos = 0; while (true) { int index = types.indexOf('|', pos); if (index == -1) break; String token = MatchUtil.normalizeWhiteSpace(types.substring(pos, index)); if (!token.isEmpty()) { result.add(token); } pos = index + 1; } if (pos < types.length()) { result.add(MatchUtil.normalizeWhiteSpace(types.substring(pos))); } return result; }