ringa_lee2017-04-18 10:58:34
Static methods cannot reference generics defined on the class, static generic methods should be used. You can use it in Object[]
之前加<T>
表示这是一个静态泛型方法。使用静态泛型方法要在List<T>
前面加<T>
as follows
public static <T> List<T> name() {
List<T> list = new ArrayList<T>();
return list;
}
PHPz2017-04-18 10:58:34
...Generics are for definition, you need to specify the type when using them