A<T extends B> and A <? extends B>
2016-04-23 22:11
344 查看
Refer to
http://stackoverflow.com/questions/5211548/what-is-the-difference-between-at-extends-b-and-a-extends-b
First of all, those are completely different constructs used in different contexts.
It declares generic type
Variable declaration such as
http://stackoverflow.com/questions/5211548/what-is-the-difference-between-at-extends-b-and-a-extends-b
First of all, those are completely different constructs used in different contexts.
A<T extends B>is a part of generic type declaration such as
public class A<T extends B> { ... }
It declares generic type
Awith type parameter
T, and introduces a bound on
T, so that
Tmust be a subtype of
B.
A<? extends B>is a parameterized type with wildcard, it can be used in variable and method declarations, etc, as a normal type:
A<? extends B> a = ...; public void foo(A<? extends B> a) { ... }
Variable declaration such as
A<? extends B> ameans that type of
ais
Aparameterized with some subtype of
B.
相关文章推荐
- 1005-Turn the corner
- Exported service does not require permission问题。
- linux补全之--hydra的运用
- 不出门就知天下事的网站,实时更新
- ios中使用模版引擎渲染HTML页面
- Tomcat下载和安装
- 线程的分离与结合
- Hadoop伪分布续
- 百度云 开通会员 不限速 打补丁
- Mybatis最入门---动态查询(foreach)
- static全局变量与普通的全局变量的区别详细解析
- swift之VirtualBox下mac环境搭建
- C# 泛型编程
- 史上最有魄力公司!20亿主要用于团队建设,要在上海做出一家BAT之外的互联网公司
- 日志系统之定时任务执行引擎
- 用C语言讲一讲位运算 入门级(详细图解)
- Java Nio 十四、Java NIO vs. IO
- hash哈希长度扩展攻击解析(记录一下,保证不忘)
- Python笔记_01列表 和元祖
- JVM 进行线程同步背后的原理