Yes,

You are the changing the properties by reference. So whatever change you do
on the object you are getting will be replicated across all its instances
(so the collection also).



On 5/18/06, Raghuveer <[EMAIL PROTECTED]> wrote:


Yes,
i have modified like this.It is working and giving me the result properly.

((TestObject)arlCollection .get(3)).setPart(strPart);

Is this correct ?

-----Original Message-----
From: Pradyumna kumar, Jena (J.) [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 18, 2006 2:57 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: object modify in collection index





I have 5 objects(java beans) in Collection.

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

>> why do u need to add?? We are just getting the reference for that
object and the object is still in the collection.

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.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to