我发现,你可以调用一个特殊类型的通用方法,如:如何在静态导入时使用类型调用泛型方法?
假设我们有一个通用的方法:
class ListUtils {
public static <T> List<T> createList() {
return new ArrayList<T>();
}
}
,我们可以把它想:
List<Integer> intList = ListUtils.<Integer>createList();
但我们如何在静态导入时调用它?例如:
List<Integer> intList = <Integer>createList();
这不起作用。
不是为你的具体例子输入推理工作吗? – Roman 2010-11-04 10:14:00
[显式类型参数调用静态导入的方法]可能重复(http://stackoverflow.com/questions/2050317/invoking-statically-imported-method-with-explicit-type-parameters) – 2012-02-28 22:52:42
[可能会重复[调用静态导入方法显式类型参数](https://stackoverflow.com/questions/2050317/invoking-statically-imported-method-with-explicit-type-parameters) – 2017-08-25 10:18:29