PRESERVING ARRAYLIST OBJECT WITHIN ANOTHER OBJECT
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   graham_cousar
Posted On:   Tuesday, February 26, 2002 05:14 AM

I have a Service object which I initiliase with name, description etc, but also an ArrayList of parameters that that service requires to execute. I call a setParams() which sets the local ArrayList to equal the passed in one using clone(), thus: ArrayList svcParams = new ArrayList(); svcParams = (ArrayList)in_list.clone(); The passed in ArrayList is cleared in the calling method using ArrayList.clear(); before the next Service object is initialised. Having done this all seems well, but when I try to retrieve the ArrayList from the Service object, I get an ArrayList of size ZERO! It is true that the ArrayList is madeup of ProcParam objects, objects I have built to hold all r   More>>

I have a Service object which I initiliase with name, description etc, but also an ArrayList of parameters that that service requires to execute. I call a

setParams()
which sets the local ArrayList to equal the passed in one using clone(), thus:


			
ArrayList svcParams = new ArrayList();
svcParams = (ArrayList)in_list.clone();


The passed in ArrayList is cleared in the calling method using

ArrayList.clear();
before the next Service object is initialised. Having done this all seems well, but when I try to retrieve the ArrayList from the Service object, I get an ArrayList of size ZERO!


It is true that the ArrayList is madeup of ProcParam objects, objects I have built to hold all relevant parameter info. These implement cloneable and have a clone() method but I don't call it explicitly.


Any ideas why the ArrayList appears to iitiate correctly, but is empty when I get it back from the Service later on?

   <<Less
About | Sitemap | Contact