Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Collections  RSS feed

 
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: 53769
127
  • 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
Boost this thread!