ListFiles performance vs file system visitor

Paulo Levi i30817 at gmail.com
Tue Feb 17 20:27:14 PST 2009


>> Also if wasn't for the isDirectory i could make a lazy File
>> extension/delegate (no normalization - if the private constructor was
>> protected that would work too), at least for the files that aren't
>> directories (that are in common usage the most of them). Any
>> alternative to is directory?
>>
>
> I don't completely understand what you are saying here but you can't tell
> the non-directories by the names and so you will have to continue to use
> isDirectory with your solution.

I mean that the current File class has a private constructor
File(String child, File parent) that doesn't do file normalization.

If isDirectory() doesn't require filename normalization i would have
the opportunity to normalize lazily the first time the files were
used, since File is not final.

But  if the problem is not listFiles() it is obviously isdirectory().

If i call listFiles on a normal file it should return null right? I
wonder if that is faster than the isDirectory call itself... no reason
to but doesn't hurt to check.

Also isDirectory() performance fixes? Make File(String child, File
parent) protected?

Pleeeeease?

Also i just noticed. Disregard the sort there, the times i told where
before i added that.



More information about the nio-discuss mailing list