If you are still using JDK 1.4, I’ve had so many times where I forget the syntax when trying to convert an ArrayList of objects to the native types. ┬áSo here’s how you do it successfully in one line of code:

MyClass[] realObjs = (MyClass[])arrayListObj.toArray(new MyClass[arrayListObj.size()]);