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
List<Object[]> arrayList;
// initialize and fill the list of arrays
// all arrays have the same length
Object[][] array2d = arrayList.toArray(new Object[][] {});
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.
What does it actually mean and why is it considered bad? I don't understand the [][]{} bit. I'm guessing that you pass an empty but initialized Object[][] to the .toArray() method?