title: guava: best practices with ImmutableList.of(E[])
body: <p>I just noticed that <a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/ImmutableList.html#of%28E%5B%5D%29" rel="noreferrer"><code>ImmutableList.of(E[])</code></a> is deprecated in favor of <code>ImmutableList.copyOf()</code>, for the obvious reason that the list can't truly be made immutable if the raw array is used elsewhere.</p>
  
  <p>What if you have a method that returns an array, and you know for a fact that the method doesn't hold onto a reference to the array, and your code doesn't hold onto a reference to the array other than passing it to <code>ImmutableList.of()</code>?</p>
  
  <p>Should I...</p>
  
  <ul>
  <li>continue to use <code>ImmutableList.of(E[])</code> (seems like a bad idea since the method will go away)</li>
  <li>use <code>Collections.unmodifiableList(Arrays.asList())</code></li>
  <li>use <code>ImmutableList.copyOf()</code> -- this seems like the best idea where performance/resource issues don't arise, otherwise the copy is unnecessary.</li>
  </ul>