my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android 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: 24183
    
  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
 
Don't get me started about those stupid light bulbs.
 
subject: Iterator and user defined collections
 
Similar Threads
Enumerations Vs Iterators
[hibernate] How to load lazy collections
problems about Collections
enumeratio or iterator
Collection and Map