title: Java addAll(collection) vs new ArrayList(collection)
body: <p>Why do i get different behaviors with:</p>
  
  <ol>
  <li><p><code>Collection col2 = new ArrayList(col);</code></p></li>
  <li><p><code>Collection col2 = new ArrayList();</code><br>
  <code>col2.addAll(col)</code></p></li>
  </ol>
  
  <p>I'm working with viewers, and the code is complex, and i'm trying to explain the "root" of the problem. Another interesting fact is the next one... </p>
  
  <pre><code>//IF i use this code i have the correct behavior in my app:
  public void updateCollection(Collection&lt;Object&gt; col) {
      this.objectCollection.clear();
      this.objectCollection.addAll(col);
  }
  
  //IF i use this code i have unexpected behavior in my app:
  public void updateCollection(Collection&lt;Object&gt; col) {
      this.objectCollection=new ArrayList(col);
  }
  </code></pre>