aspose file tools*
The moose likes Beginning Java and the fly likes Iterator and user defined collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Iterator and user defined collections" Watch "Iterator and user defined collections" New topic
Author

Iterator and user defined collections

Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67
Sir,

Can't the iterator be used with user defined collections.

In my code the for each loop is showing the result but the with the iterator, neither the program terminates nor does it give any output

Thanks in advance,
regards,
Komal
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Perhaps you can show us the code you're using "with the Iterator" -- maybe we can tell you where you're going wrong.


[Jess in Action][AskingGoodQuestions]
Komal Amaresh
Ranch Hand

Joined: Oct 06, 2008
Posts: 67
Sorry,

i was running an infinite loop.
had put a semicolon after(while(itr.hasNext());).....big blunder.

regards,
komal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterator and user defined collections