Is it slower to iterate through a list in Java like this:
for (int i=0;i
as opposed to:
According to benchmark tests in While loop, For loop and Iterator Performance Test – Java and the JavaRanch question "is using ArrayList.iterator() is faster than looping ArrayList in for loop?" the iterator is actually a bit slower.
I'd still favor readability unless I'd benchmarked my entire application and found that loop to be my bottleneck, though.