Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可以指定具有下限的通配符类型Object:
Object
public void method(Collection<? super Object> c) { // compiles, but ? can only be Object }
从逻辑上讲,未知类型只能是Object(类层次结构中没有类型在上面 Object)。
是否有使用类型的要求或充分理由<? super Object>?
<? super Object>
是的,这里有一个“?super XXXXXX”的用例。要点是使用用户/扩展将使您的收藏成为只读或只写。