Checking if a file or directory exists in Java

exists, file, java

Solution

`!Files.exists()` returns:

- `true` if the file does not exist or its existence cannot be determined

- `false` if the file exists

`Files.notExists()` returns:

- `true` if the file does not exist

- `false` if the file exists or its existence cannot be determined

Problem

From this java tutorial by oracle: Note that !Files.exists(path) is not equivalent to Files.notExists(path). Why would they not be equivalent? it does not go any further in terms of explanation. Does anybody know more information about that? Thanks in advance!

Original source