Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to express Array<T>.class

I have a method that needs a Object.class parameter like

 method(Object.class)

How can I set the class to an Array of this class? Something like

 method(ArrayList<Object>.class)

I tried

 method(new ArrayList<Object>() {})

as well. It doesnt work.

like image 507
Robin Wieruch Avatar asked Jul 18 '12 08:07

Robin Wieruch


1 Answers

You can use Object[].class.

(int[].class, String[].class, double[][][].class etc also works for that matter.)

like image 129
aioobe Avatar answered Sep 18 '22 08:09

aioobe