Documentation

The Java™ Tutorials
Hide TOC
Generics泛型
Trail: Bonus

Lesson: Generics课程:泛型

by Gilad Bracha

Introduced in J2SE 5.0, this long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety.J2SE5.0中引入了这种期待已久的对类型系统的增强,允许类型或方法在提供编译时类型安全性的同时对各种类型的对象进行操作。It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting.它将编译时类型安全性添加到集合框架中,并消除了强制转换的繁琐工作。

Introduction介绍
Defining Simple Generics定义简单泛型
Generics and Subtyping泛型和子类型
Wildcards
Generic Methods泛型方法
Interoperating with Legacy Code与遗留代码互操作
The Fine Print精美的印刷品
Class Literals as Runtime-Type Tokens将文本类作为运行时类型标记
More Fun with Wildcards使用通配符更有趣
Converting Legacy Code to Use Generics将遗留代码转换为使用泛型
Acknowledgements致谢

Previous page: Table of Contents
Next page: Introduction