title: Why does Collections.swap assign the target list to a variable of a raw type?
body: <p>In the source for JDK 1.6, the Collections class' swap method is written like this:</p>
  
  <pre><code>public static void swap(List&lt;?&gt; list, int i, int j) {
      final List l = list;
      l.set(i, l.set(j, l.get(i)));
  }
  </code></pre>
  
  <p>What reason is there for creating a final copy of the passed list? Why don't they simply modify the passed list directly? In this case, you also get the raw type warning.</p>