Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Iterator and user defined collections

 
Komal Amaresh
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you can show us the code you're using "with the Iterator" -- maybe we can tell you where you're going wrong.
 
Komal Amaresh
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,

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

regards,
komal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic