This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Collections Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Collections" Watch "Collections" New topic
Author

Collections

vuthlarhi donald
Ranch Hand

Joined: Jul 31, 2006
Posts: 76
what are the tree ways of traversing a list...I know that you can use the for each loop, iterator. what's the other one. and the advantages/disadvantages of this methods of transversing a list
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32694
    
    4
You can use an ordinary for loop, but the for-each loop is much neater.

Read the API documentation for the RandomAccess tagging interface to find out which is better.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Collections
 
Similar Threads
I have been to...
misc testing
Favourite ice cream flavour ?
Scrabble... it only takes a minute...
Best Java IDE?