commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lambrou <m...@chrislambrou.com>
Subject Re: [Collections] deep cloning
Date Sat, 04 Dec 2004 00:01:01 GMT
Edgar,

The InvokerTransformer will do the job, of course.  I just thought I'd 
point out that you can use a CloneTransformer instead - it utilises a 
number of different strategies to clone the elements in the collection, 
so stands a better chance of succeeding. It first tries the clone 
method, then looks for a copy-constructor. Finally, it tries to 
serialize/deserialize the object to clone it.

Chris


Collection clonedCollection = 
CollectionUtils.collect(originalCollection, 
CloneTransformer.getInstance());


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message