Add varargs to Path::resolve?
David Alayachew
davidalayachew at gmail.com
Mon Jun 2 23:47:01 UTC 2025
Hello @core-libs-dev <core-libs-dev at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250602/54b4fd7d/attachment.htm>
More information about the core-libs-dev
mailing list