private static void createAndCheckIsDirectory(Path dir,FileAttribute<?>... attrs) throws IOException {
  try {
    createDirectory(dir,attrs);
  }
 catch (  FileAlreadyExistsException x) {
    if (!isDirectory(dir,LinkOption.NOFOLLOW_LINKS))     throw x;
  }
}

private static void createAndCheckIsDirectory ( Path dir , FileAttribute < ? > ... attrs ) throws IOException { try { createDirectory ( dir , attrs ) ; } catch ( FileAlreadyExistsException x ) { if ( ! isDirectory ( dir , LinkOption . NOFOLLOW_LINKS ) ) throw x ; } }
used by createdirectories to attempt to create a directory . a no - op if the directory already exists .
