Collection<TextRange> (@NotNull CharSequence documentText, @NotNull CharSequence textToFind, boolean matchExactWordsOnly) { CollectConsumer<TextRange> consumer = new CollectConsumer<>(); consumeAllOccurrences(documentText, textToFind, matchExactWordsOnly, consumer); return consumer.getResult(); }