Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: The first 10 files Date: Sat, 26 Jan 2013 19:09:38 -0800 Organization: Canadian Mind Products Lines: 27 Message-ID: <2469g89u7vpchs8lo0lbc7dh7lrtldslor@4ax.com> References: <51041ff8$0$284$14726298@news.sunsite.dk> <1iop8bl8ysrfg$.rdxcxhgxuj1r$.dlg@40tude.net> Reply-To: Roedy Green NNTP-Posting-Host: K2Qzzs3EAqXk5RLzfhxcSw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: csiph.com comp.lang.java.programmer:21778 On Sat, 26 Jan 2013 15:21:53 -0800, Peter Duniho wrote, quoted or indirectly quoted someone who said : >Indeed, I suppose one could throw an exception from the FileFilter accept() >method to interrupt enumeration, if that's how listFiles() is implemented. >That would avoid the need to enumerate more than the needed number of >actual files. you could resolve that question with some System.nanotime dumps. How long for first to show up relative to others. IIRC is builds the array then feeds it to the Filter, but that could just have been someone explaining how it works conceptually. I do know that Java takes a lot longer to span a disk than C . Building the array first means less native code needed for multiplatform implementation. For most applications, you need to run every file name through the filter so it does not matter which you do first. You would save building File objects for items not passing the Filter. -- Roedy Green Canadian Mind Products http://mindprod.com The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ~ Tom Cargill Ninety-ninety Law