I am trying to write this function:
public static Class arrayTypeFor(Class elementType)
{
// ... implementation ???
}
Usage:
arrayTypeFor(int.class); // this should return a Class which is equal to int[].class
How do I do this?
I thought about doing this (but it looks pretty inefficient to me).
Array.newInstance(elementCType, 1).getClass();