• Post Reply Bookmark Topic Watch Topic
  • New Topic

I want to iterate all elements in vector and store it in another vector..?  RSS feed

 
hariharan jayaprakash
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to iterate all elements in vector and store it in another vector.. how can i achieve tat?
 
hariharan jayaprakash
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my vector elements contains are objects(element objects are own class created objects)..

like i created a class (ProductDTO,ProductDAO,ProductVO) so in my vector contains any of these type of objects elements....

So, i want to iterate this vector and again i need to add it into another vector...

hope am clear with my que...
 
Stephan van Hulst
Saloon Keeper
Posts: 7969
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an ArrayList instead of Vector. Vectors are deprecated.

If you want to iterate over a List, use the enhanced for loop. If you want to add all the elements to another collection, use the addAll() method of that collection.
 
hariharan jayaprakash
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah its workin now.. but i need to use vector only... addAll() method, i got my scenario...

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!