List<String> (@NotNull String text, char separator) { List<String> result = new ArrayList<>(); int pos = 0; int index = text.indexOf(separator, pos); while (index >= 0) { final int nextPos = index + 1; String token = text.substring(pos, index); if (token.length() != 0) { result.add(token); } pos = nextPos; index = text.indexOf(separator, pos); } if (pos < text.length()) { result.add(text.substring(pos)); } return result; }