RFR: 8262742: (fs) Add Path::resolve with varargs string

ExE Boss duke at openjdk.org
Sat Jul 8 10:38:04 UTC 2023


On Fri, 7 Jul 2023 18:50:14 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add to `java.nio.file.Path` methods which allow resolution of multiple descendants.

src/java.base/share/classes/java/nio/file/Path.java line 551:

> 549:      * @since 22
> 550:      */
> 551:     default Path resolve(Path first, Path... more) {

It might be better to have a `(Path...)Path` overload, so that when you have an array of `Path`s or `String`s, you don’t have to manually extract the first element and copy the array using:

path.resolve(paths[0], Arrays.copyOfRange(paths, 1, paths.length))

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1257219478


More information about the nio-dev mailing list