exists and notExists
Alan Bateman
Alan.Bateman at Sun.COM
Mon May 26 06:12:45 PDT 2008
Elliotte Harold wrote:
> Why do are there both exists() and notExists() methods in
> java.nio.file.Path? Is there some subtle issue such that notExists()
> is not equivalent to !exists()?
>
> Otherwise, this feels like unnecessary duplication to me. I'd rather
> have just the single exists() method.
>
An existence check yields one of three answers: the file exists, the
file does not exist, or it can't say (due a permission problem for
example). The exists and notExists are convenience methods for cases
where you want to take action when a file is confirmed to exist (at that
point in time), or confirmed to not exist.
-Alan.
More information about the nio-discuss
mailing list