Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections

 
vuthlarhi donald
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48642
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic