my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Adding a value into an existing ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Adding a value into an existing ArrayList" Watch "Adding a value into an existing ArrayList" New topic
Author

Adding a value into an existing ArrayList

Jolie Lee
Ranch Hand

Joined: May 08, 2005
Posts: 87
I've a collection of data, using iterator and add it in an arraylist.

besides the data, i've retrieved another value and wanted to store in the same arraylist. how can i do that?


Jys<br /><a href="http://jy-s.com" target="_blank" rel="nofollow">http://jy-s.com</a><br /> <br />Trying my very best to learn java, please forgive me if i'm asking some really stupid questions.
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

I've a collection of data, using iterator and add it in an arraylist.
FYI, have a look at the addAll() method.

besides the data, i've retrieved another value and wanted to store in the same arraylist. how can i do that?
The same way you add any other single object: add().
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding a value into an existing ArrayList