[7u4] Review request for CR 7134730 (original) (raw)

Kumar Srinivasan kumar.x.srinivasan at oracle.COM
Mon Feb 13 10:27:16 PST 2012


On 2/13/2012 10:23 AM, Greg Brown wrote:

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? yes brevity, error proofing, indices can go wrong with typos :)

Kumar



More information about the macosx-port-dev mailing list