Java Path File Check nio isEmptyDir(Path dir)

Here you can find the source of isEmptyDir(Path dir)

Description

is Empty Dir

License

LGPL

Declaration

private static boolean isEmptyDir(Path dir) throws IOException 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.*;
import java.nio.file.*;

public class Main {
    private static boolean isEmptyDir(Path dir) throws IOException {
        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
            return !stream.iterator().hasNext();
        }// w  w  w. ja  va  2  s .  c o  m
    }
}

Related

  1. isDirectoryEmpty(Path path)
  2. isDirectoryEmpty(String dirPath)
  3. isDirectoryInPath(File p, File d)
  4. isDirEmpty(final Path directory)
  5. isEmpty(Path dir)
  6. isEmptyDir(Path path)
  7. isEmptyDir(Path path)
  8. isEqualPath(final Path file1, final String topLevelAbsolutePath)
  9. isExcluded(Set excludes, Path path)