The following tests passes:
File aDir = new File("aDir");
assertTrue(aDir.exists());
assertTrue(aDir.isDirectory());
assertFalse(aDir.isFile());
File aFile = new File("aFile");
assertTrue(aFile.exists());
assertFalse(aFile.isDirectory());
assertTrue(aFile.isFile());
File awol = new File("notInFileSystem");
assertFalse(awol.exists());
assertFalse(awol.isDirectory());
assertFalse(awol.isFile());
On the surface of things, And it seems to imply that for all files where file.isFile() is true, file.isDirectory() is false. Is there any known type of file system/file type/java platform where this assumption does not hold?
(There are all sorts of wild in-betweeen categories of files (symlinks, junction points, symlinks/junction points with missing targets etc) that may behave slightly differently)
Looking at JavaDoc, this seems to be always the case:
http://docs.oracle.com/javase/7/docs/api/java/io/File.html#isFile()
isDirectory:
isFile: