When constructing a list of data, an ArrayList is usefull, but when using that data, an array is more convenient. My question is, what is the best way to turn an arrayList of type1 into an array of type1?
I usually do it like this:
However this is an O(n) operation and not very neat. Is there a better way?Code:Object[] O=exampleArrayListOfType1.toArray();
type1[] T=new type1[O.length];
for(int i=0; i<O.length; i++)
{
T[i]=(type1) O[i];
}

