要提高泛型代码的有效性,可以指定一个上限(或下限),而不是指定某个泛型类型参数的精确类型。 这可以使用有界通配符来实现,它的形式为 “?
To increase the usefulness of our generic code, instead of specifying the exact type of a generic type parameter, we can specify an upper (or lower) bound instead.
我们还说明了为Tiger制定的泛型类型的实现怎么会包含数个“缺陷”,这些缺陷限制了可以使用泛型类型的上下文。
We also touched upon how the incarnation of generic types scheduled for Tiger includes several "kinks" that limit the contexts in which generic types can be used.
这要归因于tiger和JSR - 14为在JVM上实现泛型类型所使用的机制。
Because of the mechanism used by Tiger and JSR-14 to implement generic types on the JVM.
应用推荐