Contents
Acknowledgments
v
Introduction
xv
Chapter 1: Generics 101
1
Why Generics?
1
Enter Generics
7
Hello Generics
10
A More Conceptual View
12
Terminology 14
Type Parameters
14
Open Types
15
Constructed Types
15
Type Arguments
15
Open and Closed Constructed Types
15
Generic Methods
16
Type Instantiation
16
Arity
17
Generic Types
17
Bringing It All Together
17
Summary
17
Chapter 2: Valuing Type Safety
19
Motivation 19
Least Common Denominator Programming
20
A Basic Example
21
Applying Generics
26
Casting Consequences
29
Interface Type Safety
31
Scratching the Surface
32
Safety vs. Clarity
32
Summary
33
Chapter 3: Generics
Templates 35
Shared Concepts
35
Run-Time vs. Compile-Time
36
02_559885 ftoc.qxd 9/8/05 11:02 PM Page vii
Summary :
1 Enter Generics 7 Hello Generics 10 A More Conceptual View 12 Terminology 14 Type Parameters 14 Open Types 15 Constructed Types 15 Type Arguments 15 Open and Closed Constructed Types 15 Generic Methods 16 Type Instantiation 16 Arity 17 Generic Types 17 Bringing It All Together 17 Summary 17 Chapter 2: Valuing Type Safety 19 Motivation 19 Least Common Denominator Programming 20 A Basic Example 21 Applying Generics 26 Casting Consequences 29 Interface Type Safety 31 Scratching the Surface 32 Safety vs.
Tags :
generics,type,types,safety,chapter,generic,constructed,summary,open,together,compiletime,why,iew