[英]Generics wildcard parameter lower bound to Object
It is possible to specify a wildcard type that has a lower bound to Object
: 可以指定具有Object
下限的通配符类型:
public void method(Collection<? super Object> c) {
// compiles, but ? can only be Object
}
Logically the unknown type can only be Object
(no type is above Object
in the class hierarchy). 逻辑上,未知类型只能是Object
(类层次结构中没有类型高于 Object
)。
Is there ever a requirement or good reason to use a type of <? super Object>
有没有要求或有充分理由使用<? super Object>
<? super Object>
? <? super Object>
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.