1 java generics inheritance abstract-class hashset
public class MyClass<Integer> extends AnotherOne<Integer> {
public MyClass(HashSet<Integer> ar) {
super(ar);
}
}
Run Code Online (Sandbox Code Playgroud)
AnotherOne是一个抽象(通用)类,它有一个HashSet<T>作为参数的构造函数。然后它有另一种方法,该方法使用该T类型作为其参数。
一切正常,但我必须Integer用作参数来覆盖该方法,而使用Integer而不是int看起来很奇怪。有没有办法使用原始int?
| 归档时间: |
|
| 查看次数: |
765 次 |
| 最近记录: |