Reputation: 69359
Can anyone explain the following result?
Path p = Paths.get("/a/b");
System.out.println(p.startsWith(p.subpath(0, 1)));
Output:
false
I would expect it to be true, since the path begins with the first element of the path.
Upvotes: 1
Views: 230
Reputation: 280064
subpath
returns a relative path. An absolute path /a/b
, does not start with a relative path a
.
But a relative path a/b
does start with a relative path a
.
Upvotes: 5