It:
add(i.toArray(new Animal[i.size()]))
List.toArray Object[], : new List<String>().toArray(), Object[]. , toArray, , : new List<String>().toArray(new String[0]), String[]. , , , , , .
. , String[] List<String> - , - .
.
, . JVM, (- ) , . , - , , . , , , , .
List, , generics, Java erasure, , , , , , ( , , JVM ). ( , Java, JVM), - , , , . List toArray(), , , Object[]. .
, , List , , , a List , , ( , ( Object[] array = new String[0];)), , , .
, :
public <E> E[] createSimilarlyTypedArray(List<E> list) {
Class<E> componentType = list.???;
return Arrays.newInstance(componentType, list.size());
}