title: How can I convert a generic list to an array?
body: <p>I'm beginning to discover the wonders of Java generics...</p>
  
  <p>Apparently, you can't create a generic array:</p>
  
  <pre><code>Stuff&lt;Thing&gt;[] array = new Stuff&lt;Thing&gt;[5]; // doesn't compile
  </code></pre>
  
  <p>So obviously, you can't do this either (which works perfectly when generics aren't involved):</p>
  
  <pre><code>// thingsList is an ArrayList&lt;Stuff&lt;Thing&gt;&gt;
  Stuff&lt;Thing&gt;[] array = thingsList.toArray(new Stuff&lt;Thing&gt;[0]);
  </code></pre>
  
  <p>So my question is, how can I get around this? How can I easily convert a generic list to an array?</p>