File.getName() vs. Path.getFileName()
Alan Bateman
Alan.Bateman at oracle.com
Thu May 26 09:52:42 PDT 2011
Christian Schlichtherle wrote:
>
> File file = new File("");
>
> assert file.getName().isEmpty();
>
> assert null == file.toPath().getFileName();
>
>
>
> That's a very subtle difference. I'ld prefer to return in
> Path.getFileName().
>
Presumably the second assert fails because file.toPath().getFileName()
will return a Path representing the empty path ("") in this case.
-Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20110526/77d46710/attachment.html
More information about the nio-discuss
mailing list