List<String> (String string) { boolean prevIsWordChar = false; final List<String> result = new SmartList<>(); final StringBuilder word = new StringBuilder(); for (int i = 0, length = string.length(); i < length; i++) { final char c = string.charAt(i); if (Character.isLetterOrDigit(c)) { if (!prevIsWordChar) { prevIsWordChar = true; } word.append(c); } else if (prevIsWordChar) { result.add(word.toString()); word.setLength(0); prevIsWordChar = false; } } if (!word.isEmpty()) { result.add(word.toString()); } return result; }