Java 7 introduced java.nio.file.Path as a possible replacement for java.io.File.
With File, when I access a file under a specific, I would do:
File parent = new File("c:\\tmp");
File child = new File(parent, "child"); // this accesses c:\tmp\child
What's the way to do this with Path?
I supposed this will work:
Path parent = Paths.get("c:\\tmp");
Path child = Paths.get(parent.toString(), "child");
But calling parent.toString()
seems ugly. Is there a better way?