将Array.newInstance静态方法视为在Java中创建泛型类型数组的一种方法。我没有看到如何从空泛型类型参数创建泛型数组:* Creates and fills a generic array with the given itempublic static <i++)}
当我调用create( "abc“,10 )时,上面的内容是有效的
在Java中,这是有效的:
//Inside other class that has no relation我无法使Class1类型为OtherType,因为泛型的要点是有一个扩展OtherType基的未知类型。我可以绕过它,但这绝对是最有效的解决方案,如果是Java,如果不工作的话,我将不得不为多个对象键入一个框架一次,我担心这会很快累积起