[7u4] Review request for CR 7134730

Greg Brown greg.x.brown at oracle.com
Mon Feb 13 10:23:13 PST 2012


> 135     public void addConfiguredClassPath(FileSet classPath) {
> 136         File parent = classPath.getDir();
> 137
> 138         DirectoryScanner directoryScanner = classPath.getDirectoryScanner(getProject());
> -139         String[] includedFiles = directoryScanner.getIncludedFiles();
> 140
> -141         for (int i = 0; i<  includedFiles.length; i++) {
> -142             this.classPath.add(new File(parent, includedFiles[i]));
> -143         }
> 	      for (String name : directoryScanner.getIncludedFiles() {
> 		  this.classPath.add(new File(parent, name);
>              }
>  144     }

Ah, I just realized that this isn't a Java 7 thing - you are just suggesting that I use the iterator rather than the index. I know it is a minor detail, but I generally tend to use an index for array iteration to avoid the heap allocation. Is there any advantage to using the iterator, aside from brevity?








More information about the macosx-port-dev mailing list