Link Details

Link 48784 thumbnail
User 201716 avatar

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.
  • 10
  • 8
  • 2735
  • 586

Comments

Add your comment
User 187652 avatar

messias replied ago:

0 votes Vote down Vote up Reply

What happened to java.lang.Cloneable?

User 210175 avatar

jtheory replied ago:

1 votes Vote down Vote up Reply

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....

User 235974 avatar

warpedjavaguy replied ago:

0 votes Vote down Vote up Reply

Copy constructors are so C++. Here is the Java way of doing it:
http://www.artima.com/objectsandjava/webuscript/ClonCollInner1.html

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.