struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siva Sajja" <sajjas...@gmail.com>
Subject Re: object modify in collection index
Date Thu, 18 May 2006 11:08:51 GMT
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 <raghuveerv@infotechsw.com> 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:jpradyu1@ford.com]
> Sent: Thursday, May 18, 2006 2:57 PM
> To: Struts Users Mailing List; raghuveerv@infotechsw.com
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message