Generic class to array of generics of same generic type
I have a method signature like

    public <T extends SomeClass> T[] findAll(Class<T> oClass, String condition)

But I'm not sure how I can create that `T[]` type from `Class<T>`. I've tried using a `Collection<T>` but I cannot cast `(T[]) collection.toArray()` and `Array.newInstance(Class<?>, int)` asks for an array class (i.e. `T[]`) already, which is of no use and redundant.

Also, obvisously, `new T[n]` does not work.

I would presume it's something easy, but I'm numb for the solution right now :)

Thanks.
Generic class to array of generics of same generic type
===

I have a method signature like

    public <T extends SomeClass> T[] findAll(Class<T> oClass, String condition)

But I'm not sure how I can create that `T[]` type from `Class<T>`. I've tried using a `Collection<T>` but I cannot cast `(T[]) collection.toArray()` and `Array.newInstance(Class<?>, int)` asks for an array class (i.e. `T[]`) already, which is of no use and redundant.

Also, obvisously, `new T[n]` does not work.

I would presume it's something easy, but I'm numb for the solution right now :)

Thanks.