Reputation: 283
Given a Class<T>
is there any way to get a Class<T[]>
without first creating an array via Array.newInstance
? Even that doesn't really do quite what I want because Array.newInstance
would return something of type Object
, so I'd still be left doing an unchecked cast.
Upvotes: 0
Views: 80
Reputation: 5737
Use Class.forName():
Class<?> arrayofTsClass = Class.forName("[L" + tClass.getName() + ";");
Upvotes: 2