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;
}
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...Generics are for definition, you need to specify the type when using them
There is an introduction in think in java