在这篇文章中,我们将讨论Paths.get()和Path.of()方法之间的相似之处和差异。
2. 相同的行为
Path.of()方法接受一个URI作为参数,并将其转换为相关对象的Path。
现在让我们来看看Paths.get()的代码:
public final class Paths {
public static Path get(URI uri) {
return Path.of(uri);
}
}
大约 2 分钟
在这篇文章中,我们将讨论Paths.get()和Path.of()方法之间的相似之处和差异。
Path.of()方法接受一个URI作为参数,并将其转换为相关对象的Path。
现在让我们来看看Paths.get()的代码:
public final class Paths {
public static Path get(URI uri) {
return Path.of(uri);
}
}