which loop is faster?
- by Mansuro
I have this loop
for (it= someCollection.iterator; it.hasNext(); )
{
//some code here
}
I changed it to:
for (it= someCollection.iterator;; )
{
if (!it.hasNext())
break;
//some code here
}
The second code ran a little bit faster in unit tests in junit on eclipse.
Is the second loop faster? I'm asking because the times given by Junit are not too exact, but they give an approximate value