troubleshooting Question

About Iterators

Avatar of tamilthambi
tamilthambi asked on
JavaEditors IDEs
43 Comments1 Solution536 ViewsLast Modified:
I want to create a iterator in my program,

Node list = new Node();
Iterator it = list.iterator();
      
      while(it.hasNext())
      {
    //iterate over all the objects in the list
    Object obj = it.next();
    //do something with that object
      }
      
But when I compile the program it gives me an error (cannot resolve symbol)with  list.iterator();
should the method iterator() should be defined what it is?, if so can you give a example on what it should contain and how it will look like return types etc...
ASKER CERTIFIED SOLUTION
Kelvin_King

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 43 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 43 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros