File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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.
rocket mass heater
subject: clone lists or objects
clone() used on array and object
Cloning in java
Understanding superclass and subclass objects
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014