void (@NotNull CharSequence fileName, @NotNull Processor<? super CharSequence> processor) { if (!processor.process(fileName)) { return; } int index = StringUtil.indexOf(fileName, '.'); while (index >= 0) { CharSequence extension = fileName.subSequence(index + 1, fileName.length()); if (extension.isEmpty()) break; if (!processor.process(extension)) { return; } index = StringUtil.indexOf(fileName, '.', index + 1); } }