Thursday, June 25, 2009

How to Iterate a Set


Iterator it = set.iterator();
while (it.hasNext()) {
// Get the element
Object element = it.next();
}

1 comments:

The Organizer: on August 9, 2009 at 4:32 PM said...

Hi:

I am currently taking the JAVA passion course offered by Sun written by Sang Shin.
In reference to the code, I thought one has to downcast the object when retrieved? Please comment.

 

Sample Java Codes Copyright © 2008 Green Scrapbook Diary Designed by SimplyWP | Made free by Scrapbooking Software | Bloggerized by Ipiet Notez