効率化

This commit is contained in:
r-ca 2024-01-13 15:13:56 +09:00
parent 04651f3b8e
commit 171c8b380c
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -21,18 +21,22 @@ public class PublicPath {
this.path.add(path);
}
public PublicPath resolve(String path) {
private void resolveInternal(String path) {
if (path.equals("..")) {
this.path.remove(this.path.size() - 1);
} else {
add(path);
}
}
public PublicPath resolve(String path) {
resolveInternal(path);
return this;
}
public PublicPath resolve(List<String> path) {
for (String p : path) {
resolve(p);
resolveInternal(p);
}
return this;
}