I am currently writing a program that should compare each file in an ArrayList with a variable size. Right now, I am doing this through a nested code loop:
if(tempList.size()>1){
for(int i=0;i<=tempList.size()-1;i++)
for(int j=i+1;j<=tempList.size()-1;j++){
System.out.println(checkBytes(tempList.get(i), tempList.get(j)));
}
}
I read several different opinions about the need for nested loops, and I was wondering if anyone has a more efficient alternative.
At first glance, each comparison will need to be done in any case, so that the performance should be fairly stable, but I am confident that there is a cleaner way to do this. Any pointers?
EDIT :: This is only part of the function, for clarity. Files were compared and placed in buckets in length - after going through a dialing map and finding a bucket that is more than one, it launches it. So - all files are the same size. I will compare the checksum until I get the bytes, but now I'm just trying to clear the loop.
In addition, a holy cow, this site responds quickly. Thanks guys.
EDIT2:: , : , - -, , , - , , ArrayList, , . , , , , .