So imagine I have the following: myList of type ArrayList<CustomType> and I want to convert it to an array, how would I go about this?
I have tried
CustomType[] myArr = (CustomType)myList.toArray();
This compile, no problem but I get a casting exception at runtime. My current solution is iterating through the ArrayList and writing each entry into the array, not good.
Any idea? Thanks.