The List
has a method toArray
such as:
<T> T[] java.util.ArrayList.toArray(T[] a)
When calling this method, I should create a new instance and pass it toArray(new MyElementClass[0])
.
Could it be defined like this:
<T> T[] java.util.ArrayList.toArray(Class<T>)
By calling toArray(MyElementClass[].class)
, can it be more effective?