If I do this:
File f = new File(\"c:\\\\text.txt\");
if (f.exists()) {
System.out.println(\"File exists\");
} else {
System.out.println(\"File not f
The Files.exists method has noticeably poor performance in JDK 8, and can slow an application significantly when used to check files that don't actually exist.
This can be applied too for Files.noExists, Files.isDirectory and Files.isRegularFile
According this you can use the following :
Paths.get("file_path").toFile().exists()