File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Update Collection of Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Update Collection of Objects" Watch "Update Collection of Objects" New topic
Author

Update Collection of Objects

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
hi,
In our application, we have an option to update previously selected list,
that means previousList contains some objects which are checked and saved in DB, while updating our application, we need to uncheck some previous objects and check more some other objects.

I can able to retrieve previousList, presentList, and originalList (total number of object). How can we update the previousList of objects with presentList of objets.
I just need simple java logic.


Thanks,
Kumar
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

You want to update the list means:
(I assume you use java collections.)
  • You want to add all items from the newList? If yes, then call addAll() method of the previous list with the new list as the argument.
  • You want to remove all items from previous list and add all items from the newList? If yes, then call clear() on the old list and then addAll() as above.

  • By the way, this is not an advanced question. (CarefullyChooseOneForum)
    [ April 03, 2008: Message edited by: Nitesh Kant ]

    apigee, a better way to API!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Update Collection of Objects