介绍 定义简单的泛型 泛型和子类继承 通配符(Wildcards) 有限制的通配符 ( Bounded Wildcards ) 泛型方法 与旧代码交互 在泛型代码中使用老代码 擦除和翻译(Erasure and Translation) 在老代码中使用泛型代码 要点(The Fine ...
基于138个网页-相关网页
Keep bounded wildcards out of return values.
不要对返回值使用通配符。
The biggest impediment to using bounded wildcards correctly is the perception that we don't need to use them!
正确使用有界通配符的最大绊脚石是认为没有必要使用它们。
Some situations will call for lower-bounded wildcards, and some for upper-bounded ones, and the get-put principle can be used to determine which should be used.
有些情况适合使用下限通配符,而另一些情况则适合使用上限通配符,通过get - put原则可以判断应该使用哪种通配符。
应用推荐