• Post Reply Bookmark Topic Watch Topic
  • New Topic

The Vector  RSS feed

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
After returning a vector, does the vector empty itself? I have a program that seems to do just that. It iterates twice.The resutlts are returned in the form of a vector.
The results for the first iteration are absent in the results for the second interation though I haven't emptied the results vector after the first iteration.
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The vector still exists, but you've exhausted the iterator. It can only be "run" once. If you need to iterate over the vector a second time, you need to obtain another iterator.
 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for understanding and answering the question. The problem was exactly that. I exhausted the iterator. And the second time I inserted results into the vector I replaced the first iterator's contents. A new Iterator required.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good catch, Bear! I was scratchin my head on the question.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!