void (@NotNull File file, Predicate<? super File> stopCondition, @NotNull Consumer<? super File> fileConsumer) { File current = file; while (true) { fileConsumer.consume(current); if (stopCondition.test(current)) break; current = current.getParentFile(); } }