Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
>The best way to go through all the items in a List (or Vector), >is with an Iterator (see example, below); it is easy to use and >will probably have much better performance than your own for->loop that accesses each item. iterator's even faster than accesing arraylist items directly? wouldn't the creation of new iterators to go through arraylist items compromise the program clarity/maintainability/performance by creating new objects (iterators) and addition of more codes (lines of code :p)? wouldn't it be simpler to just use a for-loop to check the list's each items? matt.. i'm a bit confused.. mind explaining why do u think using iterator's better? : ) don't misunderstand, matt.. i'm not being sarcastic here (i have a bad reputation beginning yesterday, so i gotta watch out :p). i do believe u have your reasons for that statement.. mind sharing it with us?
Replies:
|
Sponsored Links
|