title: Java 1.6: Creating an array of List<T>
body: <p>Why can't I create an array of List ?</p>
  
  <pre><code>List&lt;String&gt;[] nav = new List&lt;String&gt;[] { new ArrayList&lt;String&gt;() };
  </code></pre>
  
  <p>Eclipse says "Cannot create a generic array of List"</p>
  
  <p>or</p>
  
  <pre><code>ArrayList&lt;String&gt;[] nav = new ArrayList&lt;String&gt;[] { new ArrayList&lt;String&gt;() };
  </code></pre>
  
  <p>Eclipse says "Cannot create a generic array of ArrayList"</p>
  
  <p>or</p>
  
  <pre><code>List&lt;String&gt;[] getListsOfStrings() {
      List&lt;String&gt; groupA = new ArrayList&lt;String&gt;();
      List&lt;String&gt; groupB = new ArrayList&lt;String&gt;();
      return new List&lt;String&gt;[] { groupA, groupB };
  }
  </code></pre>
  
  <p>But I can do this:</p>
  
  <pre><code>List[] getLists() {
      return new List[] { new ArrayList(), new ArrayList() };
  }
  </code></pre>
  
  <p>Eclipse says that List and ArrayList are <em>raw types</em> but it compiles...</p>
  
  <p>Seems pretty simple, why won't it work?</p>