- interface Procedure<T, E extends Throwable> {
- void execute(T t) throws E;
- }
-
- private static <E extends Throwable> void forEachIndexPath(Procedure<File, E> callback) throws E {
- for (File indexPath : getIndexBaseLocation().listFiles(new FileFilter() {
- @Override
- public boolean accept(File pathname) {
- return pathname.isDirectory();
+ private static void forEachIndexPath(Consumer<Path> callback) throws IOException {
+ try (Stream<Path> paths = Files.walk(getIndexBaseLocation(), 1).filter(Files::isDirectory)) {
+ Iterator<Path> iter = paths.iterator();
+ while (iter.hasNext()) {
+ Path p = iter.next();
+ callback.accept(p);