I already read some of the answers following which I know 1 of the technique of creating a generic array is using reflection but what of I write the below generic method for creating an array? Is this potentially dangerous in any way?
public <E> E[] getArray(int size, Class<E> e) {
E[] arr = (E[])new Object[size];
return arr;
}