Return the first 100 files which satisy the FileFilter
1 posts in topic
Flat View  Flat View

Posted By:   Sanket_Koli
Posted On:   Wednesday, March 13, 2002 06:01 PM

FileFilter returns ALL the files in the directory that satisfy the FileFilter . However I want control the number of files returned. For instance return the first 100 files that satisfy the filter. I thought of having a counter in the FileFilter class which will return false after 100. This will do the job but the problem with that is that the FileFilter is called anyways for all the files in that directory. It gets the job done but I am concerned of the processing time.

Any ideas!!!

Re: Return the first 100 files which satisy the FileFilter

Posted By:   Anonymous  
Posted On:   Thursday, March 14, 2002 01:01 AM

Have you tested the timing? I understand your concern, but I'm not so sure that performances are so bad. Considering that the other solution is to have FileFilter return everything and then cut the returned array to 100... but this would take longer.

A faster solution would require JNI, but you will loose portability.


About | Sitemap | Contact