A difficult question which I\'m close to giving up all hope on. I\'m trying to make a
function, but am having problems getting ArrayList.toArray()
to return the ty
toArray() always returns an object array.
To return an array of a specific type, you need to use toArray(Object[]).
To provide the correct type for the array argument, you need to use the specific class or in this case use reflections.
try
return (T[]) list.toArray(Array.newInstance(one.getClass(), list.size()));