Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You shouldn't need subclasses that takes <code>LinkedList&lt;UserProfile&gt;</code> and <code>ArrayList&lt;UserProfile&gt;</code> to begin with. Working with <code>List&lt;UserProfile&gt;</code> is more than fine, it's recommended (see <em>Effective Java 2nd Edition, Item 52: Refer to objects by their interfaces</em>).</p> <p>Do keep in mind that <code>LinkedList&lt;E&gt; implements List&lt;E&gt;</code>, and <code>ArrayList&lt;E&gt; implements List&lt;E&gt;</code>, so if you take a <code>List&lt;E&gt;</code>, you can take both <code>LinkedList&lt;E&gt;</code> and <code>ArrayList&lt;E&gt;</code> already (and all other implementors of <code>List&lt;E&gt;</code> out there).</p> <hr> <h3>Regarding <code>clone()</code></h3> <p>It's well understood now that <code>clone()</code> is deeply broken in Java, and should not be used (see <em>Effective Java 2nd Edition, Item 11: Override clone judiciously</em>).</p> <p>From <a href="http://www.artima.com/intv/bloch13.html" rel="nofollow noreferrer">an interview with author Josh Bloch</a>:</p> <blockquote> <p>If you've read the item about cloning in my book, especially if you read between the lines, you will know that I think <code>clone</code> is deeply broken [...] There are very few things for which I use <code>Cloneable</code> anymore [...] It's a shame that <code>Cloneable</code> is broken, but it happens.</p> </blockquote> <h3>Related questions</h3> <ul> <li><a href="https://stackoverflow.com/questions/665860/deep-clone-utility-recomendation">Deep clone utility recomendation recomendation</a></li> <li><a href="https://stackoverflow.com/questions/715650/java-how-to-clone-arraylist-but-also-clone-its-items">Java: how to clone ArrayList but also clone its items?</a></li> <li><a href="https://stackoverflow.com/questions/2597965/why-people-are-so-afraid-of-using-clone-on-collection-and-jdk-classes">Why people are so afraid of using clone() (on collection and JDK classes) ?</a></li> <li><a href="https://stackoverflow.com/questions/2326758/how-to-properly-override-clone-method">How to properly override clone method?</a></li> <li><a href="https://stackoverflow.com/questions/1106102/clone-vs-copy-constructor-vs-factory-method">clone() vs copy constructor vs factory method??</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload