R
RVic
I have an ArrayList which I populate with DmFieldInfo objects (I can
confirm this is working correctly):
ArrayList<DmFieldInfo> arrayList = new ArrayList<DmFieldInfo>();
I want to now move tis ArrayList over to an Array of DmFieldInfo
objects, so:
DmFieldInfo dmFieldInfos [] = new DmFieldInfo[arrayList.size()];
dmFieldInfos = (DmFieldInfo[]) arrayList.toArray();
And on this last line I get the error message at runtime that:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[DmFieldInfo;
How else do I convert this ArrayList of a particular object type to an
Array of that object type? Thanks.
confirm this is working correctly):
ArrayList<DmFieldInfo> arrayList = new ArrayList<DmFieldInfo>();
I want to now move tis ArrayList over to an Array of DmFieldInfo
objects, so:
DmFieldInfo dmFieldInfos [] = new DmFieldInfo[arrayList.size()];
dmFieldInfos = (DmFieldInfo[]) arrayList.toArray();
And on this last line I get the error message at runtime that:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[DmFieldInfo;
How else do I convert this ArrayList of a particular object type to an
Array of that object type? Thanks.