Does calling clone() on a collection clone the contents of the collection as well? What I actually have is a Hashtable with a bunch of string settings as well as an object that performs some standard processing functions. Sticky point is the object implements Singleton. If the collection(Hashtable) is cloned, will the Singleton object be cloned as well? Or will it be null or some other state? Thanks!
CJP (Certifiable Java Programmer), AMSE (Anti-Microsoft Software Engineer)
Author of Posts in the Saloon
No, the default implementation of collection class clone is a shallow clone, the contents are still pointing to the same objects. It is very simple to test it out. Just make a change on an object on the cloned one, you will see the original is changed too. Thanks! Roseanne Join our SCJD Study Group when certified [This message has been edited by Roseanne Zhang (edited December 17, 2001).]