Click to See Complete Forum and Search --> : best collection


raghu123
05-18-2006, 04:36 AM
I have 5 objects(java beans) in Collection.

I need retrive object from index 3 in collection modify it and add to same index.

What is best collection for this requirement.

At present i tried this with arraylist.
But in addition to object with 3 rd index modified i am getting one more object added in Arraylist i.e 6 objects in collection.

Waylander
05-18-2006, 04:52 AM
Arraylist is probably your best bet for such a requirement, Arraylists are quite good especially with the generics in the new version.

The problem with the extra object in the collection is probably the code that manipulates the arraylist not the list itself.

If you paste it in I would have a look at it if you like.


Waylander.

raghu123
05-18-2006, 05:22 AM
As per below code the modified object at index 3 is updated in arlCollectionOrderRfq collection. But how about the same collection in actionform in my struts application. This collection of objects is a method in Struts ActionForm


ArrayList arlCollection = orderPartsActionForm.getArlCollection();
if(arlCollection !=null && arlCollection .size()>0){
obg = (TestObject)arlCollection .get(3);
obg.setPart(strPart);


}//end if