By unchqua
via informit.com
Published: Oct 22 2007 / 12:05
Do you shy away from complicated programming language techniques? Have you never quite had the time to understand the finer details of copy constructor or linked lists? You may be missing out on some powerful problem-solving mechanisms, and author Stephen Morris leads you through them.
Comments
messias replied ago:
What happened to java.lang.Cloneable?
jtheory replied ago:
Hmm. Not recommended... it's just bizarre that the author doesn't mention features built-in to Java like Object.clone(), or java.util.LinkedList (instead of giving the code to implement his own version)... and he just does some hand-waving at the end instead of giving any useful advice on how to use these concepts.
There are risks to his "copy()" constructor and interface, as well... he doesn't touch on deep vs. shallow clones, doesn't seem to understand that allocating a new Object within a constructor vs. a normal method vs. anywhere else has the same memory requirements, and doesn't mention the maintenance issues of manually doing a field-by-field copy of an object with more than 3 members.
I suspect newbie developers would be more confused than anything, reading this....
warpedjavaguy replied ago:
Copy constructors are so C++. Here is the Java way of doing it:
http://www.artima.com/objectsandjava/webuscript/ClonCollInner1.html
Voters For This Link (10)
Voters Against This Link (8)