This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Testing and the fly likes Iterator in TestNG class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Iterator in TestNG class" Watch "Iterator in TestNG class" New topic
Author

Iterator in TestNG class

justin hoffer
Greenhorn

Joined: Jun 08, 2011
Posts: 1
If a class implements iterator interface, it provides next() and hasnext(). Do these next() and hasnext() get called automatically when the class's object is created?

Thanks
Justin
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Justin,
Welcome to CodeRanch!

No. next() and hasNext() are not called automatically on an iterator.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Iterator in TestNG class
 
Similar Threads
Please help me understand Iterator - I am a beginner and I did a reserch but I didn't find an answer
Q about ArrayList/LinkedList
Rant about java Iterator interface
Why is this hashmap iterating through an infinite loop?
My LinkedList Iterator - Can't print first element - No use of Java API