Re: FilenameFilter woes
Can we see the code for FilenameFilter?
You can download the code from Sun, but it won't be much because it's an
interface. Better would be to read the Javadocs for it:
How are files and directories represented in Java?
By whether File.isDirectory() returns true.
or contrariwise, whether isFile() does not.
Needless to say the File methods are pass-throughs for information from the
To the OP: You are truly going to regret all those println() calls in a
FilenameFilter.accept() method. They obscure the logic, both at compile time
and run time, and will slow things down horribly. What you want is the
A FilenameFilter is supposed to be rather lean, implementable as an anonymous
class. Sometimes it pays to write one into fullness, as you did, for the more
complex implementations, which perhaps this is. Even so, keep the sensibility
of a lean implementation when writing one in its own named class.
Given the kinds of tests you're performing, you might consider implementing a
FileFilter instead, in conjunction with the File.listFiles( FileFilter ) method.