code: private static void checkDir(Path self) throws FileNotFoundException, IllegalArgumentException {
          if (!Files.exists(self))
              throw new FileNotFoundException(self.toAbsolutePath().toString());
          if (!Files.isDirectory(self))
              throw new IllegalArgumentException("The provided Path object is not a directory: " + self.toAbsolutePath());
      }
docs: This method is used to throw useful exceptions when the eachFile* and eachDir closure methods
  are used incorrectly.
  
  @param self The directory to check
  @throws java.io.FileNotFoundException if the given directory does not exist
  @throws IllegalArgumentException      if the provided Path object does not represent a directory
  @since 2.3.0