ArrayList of Arrays to 2d Array in Java
<p>I recently had a problem typecasting/converting an ArrayList of arrays to a 2d array. I found an answer on this site that told me to use</p>

<pre><code>List&lt;Object[]&gt; arrayList;
// initialize and fill the list of arrays
// all arrays have the same length
Object[][] array2d = arrayList.toArray(new Object[][] {});
</code></pre>

<p>That worked, but I googled it for a bit and read somewhere that it is conseidered bad practice. I still used it, as it was the only one line variant that actually worked.</p>

<p>What does it actually mean and why is it considered bad? I don't understand the <code>[][]{}</code> bit. I'm guessing that you pass an empty but initialized <code>Object[][]</code> to the <code>.toArray()</code> method?</p>