How do I create a java.nio.file.Path
instance denoting a child path, if I already have an instance pointing to the parent directory on the same file system?
Currently, I'm using
final Path parent = Paths.get("usr", "local");
final Path child = Paths.get(parent.toString(), "bin");
-- but this doesn't look very elegant.
What I'm looking is some sort of a java.io.File(File parent, String child)
constructor for NIO.2.
You can write child = parent.resolve("bin");
resolve
can take Path or String as argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With