I have searched for this, but unfortunately, I don\'t get the correct answer.
class Helper { public static T[] toArray(List list) {
You can't instantiate a Generic type like you did here:
T[] array = (T[]) new Object[list.size()];
As, if T is bounded to a type, you're typecasting the new Object array to a bounded type T. I would suggest using List.toArray(T[]) method instead.
T
Object