A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
clone lists or objects
Joined: Jun 28, 2008
Apr 02, 2009 06:51:54
I want to copy/clone a list of Objects:
// copy reference
how can I copy the value instead of the reference?
Is that right?:
// copy Value instead of reference
Or is there a other way?
Joined: Jan 28, 2003
Apr 02, 2009 06:57:48
That is the correct way to make a new
with the same contents of the list returned by getNames() - so yeah, copying the value. It does not create new Name objects inside the list, those values will still be shared between both lists.
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: clone lists or objects
Understanding superclass and subclass objects
Cloning in java
clone() used on array and object
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014