The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001

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:

hmmmm

Posted by Chin Loong on October 26, 2001 at 4:27 AM

>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



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us