I have a method that needs an Object.class parameter like
method(Object.class)
How can I set a class in an Array of this class? Sort of
method(ArrayList<Object>.class)
I tried
method(new ArrayList<Object>() {})
. He does not work.
You can use Object[].class.
Object[].class
( int[].class, String[].class, double[][][].classEtc.).
int[].class
String[].class
double[][][].class
You can do this by expanding your own class from ArrayList
class UserList extends ArrayList<User>{}
Now you can do it
UserList.class