Given: a file named example.xml
Aim: to test if the file example.xml.sha256
exists.
What is the most elegant/efficient way to do this in Java 7+ (nio2, so using java.nio.files
)?
I have this, but it looks a little bit ugly for me:
Path path = Paths.get("/../example.xml");
if (Files.exists(Paths.get(path.toString() + ".sha256")))) {
...
}