Re: Clone java collection & static variable??
- From: "mingclee1@xxxxxxxxx" <mingclee1@xxxxxxxxx>
- Date: 2 Aug 2005 14:02:08 -0700
Hello Tom,
Thanks for your repsonse, and sorry for the messy code.
Not it doesn't. Your code is consistent with shallow copies. It is
however very difficult to follow.
I thought a shallow copy would be when you call clone() on an array, it
creates a new object reference to the array, but the reference inside
the array stay the same? The output in the program shows otherwise.
It also clone object references inside the array. Isn't that the
behaviour of deep copy?
So, if a shallow copy on a java collection will clone the object
reference to the collection and clone the object reference it contains,
then a deep copy of java collection would be the above plus clone any
object references inside the object in the array. Ex:
class Entry{
int val
EntryList e_list // deep copy will also clone this?
Thanks
.
- Follow-Ups:
- Re: Clone java collection & static variable??
- From: Thomas Hawtin
- Re: Clone java collection & static variable??
- References:
- Clone java collection & static variable??
- From: mingclee1@xxxxxxxxx
- Re: Clone java collection & static variable??
- From: Thomas Hawtin
- Clone java collection & static variable??
- Prev by Date: Re: JAWS and Netscape/Firefox
- Next by Date: Re: JAWS and Netscape/Firefox
- Previous by thread: Re: Clone java collection & static variable??
- Next by thread: Re: Clone java collection & static variable??
- Index(es):
Relevant Pages
|