• Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterator  RSS feed

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It compiles and execute perfectly without any output.

Why doesn't it throw any Exception ? neither iterator() nor hasNext() have any problem ?
 
Stephan van Hulst
Saloon Keeper
Posts: 7734
142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think myList is null? What makes you think iterator is null?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:What makes you think myList is null? What makes you think iterator is null?


Sorry that is not null but empty.I did never iterate empty collection so got confused.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!