如何造Array of Generic Type# Java - 爪哇娇娃
b*u
1 楼
For example
public class SpecialArray {
T[] createSpecialArray()
{
return (T[])Array.newInstance(???, 10);
}
}
如何获得 T 的type at runtime by Reflection?
I am not allowed to change API or method argument).
So I can not use T[] createSpecialArray(Class clazz).
public class SpecialArray
T[] createSpecialArray()
{
return (T[])Array.newInstance(???, 10);
}
}
如何获得 T 的type at runtime by Reflection?
I am not allowed to change API or method argument).
So I can not use T[] createSpecialArray(Class