From c98657df794f21c8992d2dad54bc347eb54a3597 Mon Sep 17 00:00:00 2001 From: siyuanzhou Date: Sat, 30 Nov 2019 16:51:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=95=B4=E4=B8=AA=E7=BF=BB?= =?UTF-8?q?=E8=AF=91=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/book/20-Generics.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/book/20-Generics.md b/docs/book/20-Generics.md index 249b4e5..822d48f 100644 --- a/docs/book/20-Generics.md +++ b/docs/book/20-Generics.md @@ -2764,16 +2764,26 @@ Java 7 引入了 **java.util.Objects** 库,使创建 `equals()` 和 `hashCode( ## 问题 - + ## 自我约束类型 - + +Java泛型中会定期出现一种让人费解的习惯用法。 看起来是这样的: + +``` +class SelfBounded> { // ... +``` + +这具有两个指向彼此的镜子的眩晕效果,这是一种无限的反射。 **SelfBounded**类采用通用参数`T`,`T`受一个界限约束,该界限为**SelfBounded**,其中`T`为参数。 + ## 动态类型安全 - + + + ## 泛型异常