iterator and for loop

Hello

For going through a collection as a List, I can use Iterator and for loop as the following:

for (int i=0; i<myList.size(); i++){

...

}

OR

Iterator i = myList.iterator();

while(i.hasNext()){

...

}

Which way is better and why

Thanks for any help

sh>

[338 byte] By [sonhoanga] at [2007-10-3 3:19:00]
# 1
The "best" way is the way that you like the most. Kinda like red vs. blue - blue is the best.
IanSchneidera at 2007-7-14 21:10:52 > top of Java-index,Java Essentials,Java Programming...