Posted By

vonkinder on 06/18/08


Tagged

iterator for


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

zdroshnya


Iterate Collection


 / Published in: Java
 

  1. ArrayList a_list = new ArrayList ();
  2.  
  3. for (Iterator it = a_list.iterator (); it.hasNext (); ) {
  4. Object o = it.next ();
  5. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: mattsidesinger on September 14, 2008

Better (Java 5):

` List list = new ArrayList();

for (Object o : list) { // o.toString(); } `

Posted By: vonkinder on October 20, 2008

shure! thanks Matt

You need to login to post a comment.