Hello @core-libs-dev <core-libs-dev@openjdk.org>,

I have an instance of java.nio.file.Path to represent a root folder. I then
create many other instances of Path that refer to subfolders of that root
folder -- oftentimes, many levels deep. To do this, I use
Path.resolve(String).

However, I often find myself writing 4 or 5 layers deep of Path resolution.

rootPath
.resolve("src")
.resolve("main")
.resolve("java")
.resolve("someModule")
.resolve("somePackage")
;

I would much prefer to just use varargs, and list them all up front, as
opposed to having to call resolve over and over.

rootPath.resolve("src", "main", "java");

And I am ignorant about performance, but maybe there is a performance
benefit to be gained here? It appears that I don't need to create multiple
instances of Path anymore.

Thank you for your time and consideration.
David Alayachew

Reply via email to