Table of contents for Java generics and collections / Maurice Naftalin and Philip Wadler.


Bibliographic record and links to related information available from the Library of Congress catalog
Note: Electronic data is machine generated. May be incomplete or contain other coding.


Counter
Part I Generics
I  Introduction  .....   ...............   .                            3
1.1  Generics                                                       4
1.2  Boxing and Unboxing                                             7
1.3  Foreach                                                         9
1 4  Generic Methods and Varargs                                    10
1.5  Assertions                                                     13
2   Subtypingand Widcards     .......... ..                             15
2.1  Subtyping and the Substitution Principle .                     15
2.2  Wildcards with extends                                         17
2.3  Wildcards with super                                           18
214  The Get and Put Principle                                      19
1.5  Arrays                                                         22
2.6  Wildcards Versus Type Parameters                               25
2.7  Wildcard Capture                                               27
2.8  Restrictions on Wildcards                                      28
3   Comparison and Bounds . . . .,: ".         . . .                    31
3.1  Comparable                                                     31
3.2  Maximum of a Collection                                        34
33   A Fruity Example                                               36
3,4  ComparaTor                                                     37
".5 BEnunmerated Ty pes                                             43
3,6  Multiple Bounds                                                47
3 7  B dges                                                         48
8    Cova riant Overridin g                                         50
4   Declarations  .  .              . . ,.. ..   ......                 53
4.1  Constructors                                                   53
4.2  Static Members                                                 54
43   Nested Classes                                                 55
4.4  How Erasure Works                                              58
5   Evolution, Not Revolution .........     ... ......61..
5.1  Legacy Library with Legacy Client                              62
5.2  Generic Library with Generic Client                            62
53   Generic Library with Legacy Client                             64
5.4  Legacy Librar with Generic Client                              67
5.4.1 Evolving a Library using Minimal Changes                 67
5.4.  Evolving a Library using Stubs                           70
5.43  Evolving a Library using Wrappers                        71
5.5  Conclusions                                                    73
6   Reification  ...  .....  .....    ......        .......   .....     75
6.   Reifiable 'rypes                                               75
6.2  Instance Tests and Casts                                       76
6.3  Exception Handling                                             81
6.4  Array Creation                                                 83
6.5  The Prinfcple of Truth in Advertising                          84
6.6  The Principle of Indecent Exposure                             89
6.7  How to Define ArrayList                                        91
6.8  ATay Creation and Varargs                                      92
h.9  Arrays as a Deprecated Type                                    95
6.10 Summning Up                                                    97
7   Reflection  .    . .  .  .  ....... .......     ..........          99
7.1  GCnerics for Reflection                                        99
7.2  Reflected Types are Reifiable Types                            101
7.3  Relection for Primitive Types                                  103
"7.4  A Generic Reflection Library                                  103
7.5  Reflection for Generics                                        106
7.6  Reflecting Generic Types                                       108
8   Effective Generics ........... .  .   . . . . . .                   113
8.1   T ke Care when Calling Legacy Code                            113
8.2   se Checked Collections to Enforce Security                     15
8.3  Specialize to Create Reifiable Types                            16
8.4  Maintain Binary Compatibility                                  121
9   Design Patterns .. . ..... ..........                           .   127
9.1  Visitor                                                        127
9.2  Interpreter                                                    131
9.3  Function                                                       132
9.4  Strategy                                                       135
i95  Subject-Observer                                               141
Part I1    Collections
10 The Main Interfaces of the Java Collections Framework . . . . . . ..  151
11 Preliminaries  1...........                      .3. .  . .  . .  .  .  153
Sil. Iterable and Iterators                                         153
1 .12 Implementations                                              155
113 Efficiency and the O-Notation                                   156
S 114 Contracts                                                     157
11.5 Collections and Thread Safety                                  159
11. .1 Synchronization and the Legacy Collections              161
1 5.2 JDK 1.2: Synchronized Collections and Fail-Fast iterators  162
11.5.3 Concurrent Collections: Java 5 and Beyond               164
12  The Collection Interface  .. . ..... .  .................           167
12.1 Using the Methods of Collection                                170
12.2 Implementing Collection                                        176
S2.3 Collection Constructors                                        176
13  Sets  .   ..  .. . ........      .......... I  I           .        177
131  Implementing Set                                               177
13.1.1 HashSet                                                 178
131 2 LinkedHashSet                                            180
13.1.3 CopyOnWriteArraySet                                     181
13.1.4 EnumSet                                                 182
13,2 SortedSet and NavigableSet                                     184
1 .2.1 TreeSet                                                 190
13.2.2 ConcurrentSkippLIstSet                                  193
13.3 Comparing Set Implemefntationts                                195
14 Queues    . ...              .               .  ..                   197
14. Using the Methods of Qeue                                       199
14.2 Implementing Queue                                             201
1412.1 PriorityQueue                                           201
142.2 ConcurrentLinkedQueue                                    203
143 BtockingQueue                                                   203
14.31 Usig the Methods of BlockingQueue                       205
14.3.2 Imnplementing BlockingQueue                             208
14.4 Deque                                                          212
14.41 Implementing Deque                                       214
14.42 BiockingDeque                                            2.15
14.5 Comparing Queue Implementations                                216
15  Lists   .   t      ....              .  .  .  .  ....    .  .    .  219
15.1 Using the Methods of List                                      221
15.2 Implementing List                                              224
1521 ArrayList                                                 224
15.2.2 LinkedList                                              226
15.2.3 CopyOnWriteAn-ayList                                    227
15.3 Comparing List Implementations                                 227
16  M aps  .. .....     .........     .   ...   .  ........           .  229
M 1 Using the Methods of Map                                        231
16.2 Implementing Map                                               232
i6.. 1 HashMap                                                233
16.2.2 Linked iashMap                                          233
16.2.3 WeaklashMap                                             235
"16 .24 IdentityHashMap                                      237
16.2.5 EnumMap                                               239
16.3 SortedMap and NavigableMap                                   239
16.3,1 TreeMap                                               243
16.4 ConcurrentMap                                                243
"16.4.1 ConcurrentHashMap                                    244
16.5 ConcurrentNavigableMap                                       245
16.5.1 ConcurrentSkipListMap                                 245
16i6 Comparing Map Implementations                                245
17 The Collections Class ..    ....                             .     247
17.1 Generic Algorithms                                          247
17 t. 1 Changing the Order of List Elements                  247
"17.1.2 Changing the Contents of a List                      248
"17.13 Finding Extreme Values in a Collection                249
17.1.4 Finding Specific Values in a List                     249
172 Collection Factories                                          250
173 Wrappers                                                      251
17.3.1 Synchronized Collections                              25 1
17.3.2 Unmodifiable Collections                              252
17.3.3 Checked Collections                                   252
17.4 Other Methods                                                253



Library of Congress subject headings for this publication: Java (Computer program language), Object-oriented programming (Computer science)