void (@NotNull String text, @NotNull List<? super String> result) { int start = 0; while (start < text.length()) { int next = nextWord(text, start); result.add(text.substring(start, next)); start = next; } }