title: How to make a deep copy of Java ArrayList
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/715650/how-to-clone-arraylist-and-also-clone-its-contents">How to clone ArrayList and also clone its contents?</a>  </p>
  </blockquote>
  
  
  
  <p>trying to make a copy of an ArrayList. The underlying object is simple containing on Strings, ints, BigDecimals, Dates and DateTime object.
  How can I ensure that the modifications made to new ArrayList are not reflected in the old ArrayList?</p>
  
  <pre><code>Person morts = new Person("whateva");
  
  List&lt;Person&gt; oldList = new ArrayList&lt;Person&gt;();
  oldList.add(morts);
  oldList.get(0).setName("Mortimer");
  
  List&lt;Person&gt; newList = new ArrayList&lt;Person&gt;();
  newList.addAll(oldList);
  
  newList.get(0).setName("Rupert");
  
  System.out.println("oldName : " + oldList.get(0).getName());
  System.out.println("newName : " + newList.get(0).getName());
  </code></pre>
  
  <p>Cheers,
  P</p>