void (@NotNull String rootPath, @NotNull Consumer<? super String> consumer) { int index = rootPath.lastIndexOf('/'); while (index > 0) { String containingDirectoryPath = rootPath.substring(0, index); consumer.accept(containingDirectoryPath); index = rootPath.lastIndexOf('/', index - 1); } }