List<String> (@NotNull String text) { List<String> result = null; int start = -1; for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); boolean isIdentifierPart = Character.isJavaIdentifierPart(c); if (isIdentifierPart && start == -1) { start = i; } if (isIdentifierPart && i == text.length() - 1) { if (result == null) { result = new SmartList<>(); } result.add(text.substring(start, i + 1)); } else if (!isIdentifierPart && start != -1) { if (result == null) { result = new SmartList<>(); } result.add(text.substring(start, i)); start = -1; } } if (result == null) { return Collections.emptyList(); } return result; }