title: Defects of Immutable collections of Guava?
body: <p>I am not sure the defects of Immutable collections I understand is correct, so I list them in this answer. Hope someone corrects me here.</p>
  
  <p>a): Comparing to Collections.unmodifiableXXX(), ImmutableXXX.copyOf() <strong>loses the source collection feature</strong>. For example, when a linkedList is put into ImmutableList.copyOf(), the ImmutableList is not linked anymore. Same as Tree based collection.</p>
  
  <p>b): People think Collections.unmodifiableXXX just uses same reference of source collection, so once the source collection is changed, Collections.unmodifiableXXX is also changed. But my solution is to wrap a source collection into a temp collection which is passed to ImmutableXXX.copyOf(). See code below:</p>
  
  <pre><code>List&lt;String&gt; l = new ArrayList&lt;String&gt;();
  List&lt;String&gt;  unmodifiableList = Collections.unmodifiableList(l);
  ImmutableList&lt;String&gt; immutableList= ImmutableList.copyOf(l);
  l.add("a");//unmodifiableList is also added "a", immutableList not.
  
  /*My solution as follows:
  So unmodifiableList2 is also immutable as ImmutableList.copyOf(l) does*/
  List&lt;String&gt; unmodifiableList2= Collections.unmodifiableList(new ArrayList(l));
  </code></pre>
  
  <p>What's your understanding of Immutable collection? Thanks!</p>