Flylib.com

Books Software

 
 
 

Java Generics and Collections


book cover
Java Generics and Collections
By Maurice Naftalin, Philip Wadler
...............................................
Publisher: O'Reilly
Pub Date: October 2006
Print ISBN-10: 0-596-52775-6
Print ISBN-13: 978-0-59-652775-4
Pages: 294
 

Table of Contents   Index
overview

This comprehensive guide shows you how to master the most important
changes to Java since it was first released. Generics and the greatly
expanded collection libraries have tremendously increased the power of
Java 5 and Java 6. But they have also confused many developers who
haven't known how to take advantage of these new features.


Java Generics and Collections covers everything from the most
basic uses of generics to the strangest corner cases. It teaches you
everything you need to know about the collections libraries, so you'll
always know which collection is appropriate for any given task, and
how to use it.


Topics covered include:

  • Fundamentals of generics: type parameters and generic methods

  • Other new features: boxing and unboxing, foreach loops , varargs

  • Subtyping and wildcards

  • Evolution not revolution: generic libraries with legacy clients and
    generic clients with legacy libraries

  • Generics and reflection

  • Design patterns for generics

  • Sets, Queues, Lists, Maps, and their implementations

  • Concurrent programming and thread safety with collections

  • Performance implications of different collections


Generics and the new collection libraries they inspired take Java to a
new level. If you want to take your software development practice to
a new level, this book is essential reading.



Philip Wadler is Professor of Theoretical Computer Science at the
University of Edinburgh, where his research focuses on the design of
programming languages. He is a co-designer of GJ, work that
became the basis for generics in Sun's Java 5.0.


Maurice Naftalin is Technical Director at Morningside Light Ltd., a software consultancy in the United Kingdom. He has most recently served as an architect and mentor at NSB Retail Systems plc, and as the leader of the client development team of a major UK government social service system.



"A brilliant exposition of generics. By far the best book on the
topic, it provides a crystal clear tutorial that starts with the
basics and ends leaving the reader with a deep understanding of both
the use and design of generics."

Gilad Bracha, Java Generics Lead, Sun Microsystems



book cover
Java Generics and Collections
By Maurice Naftalin, Philip Wadler
...............................................
Publisher: O'Reilly
Pub Date: October 2006
Print ISBN-10: 0-596-52775-6
Print ISBN-13: 978-0-59-652775-4
Pages: 294
 

Table of Contents   Index

    Copyright
    Dedication
    Preface
    Part I:  Generics
          Chapter 1.  Introduction
      Section 1.1.  Generics
      Section 1.2.  Boxing and Unboxing
      Section 1.3.  Foreach
      Section 1.4.  Generic Methods and Varargs
      Section 1.5.  Assertions
          Chapter 2.  Subtyping and Wildcards
      Section 2.1.  Subtyping and the Substitution Principle
      Section 2.2.  Wildcards with extends
      Section 2.3.  Wildcards with super
      Section 2.4.  The Get and Put Principle
      Section 2.5.  Arrays
      Section 2.6.  Wildcards Versus Type Parameters
      Section 2.7.  Wildcard Capture
      Section 2.8.  Restrictions on Wildcards
          Chapter 3.  Comparison and Bounds
      Section 3.1.  Comparable
      Section 3.2.  Maximum of a Collection
      Section 3.3.  A Fruity Example
      Section 3.4.  Comparator
      Section 3.5.  Enumerated Types
      Section 3.6.  Multiple Bounds
      Section 3.7.  Bridges
      Section 3.8.  Covariant Overriding
          Chapter 4.  Declarations
      Section 4.1.  Constructors
      Section 4.2.  Static Members
      Section 4.3.  Nested Classes
      Section 4.4.  How Erasure Works
          Chapter 5.  Evolution, Not Revolution
      Section 5.1.  Legacy Library with Legacy Client
      Section 5.2.  Generic Library with Generic Client
      Section 5.3.  Generic Library with Legacy Client
      Section 5.4.  Legacy Library with Generic Client
      Section 5.5.  Conclusions
          Chapter 6.  Reification
      Section 6.1.  Reifiable Types
      Section 6.2.  Instance Tests and Casts
      Section 6.3.  Exception Handling
      Section 6.4.  Array Creation
      Section 6.5.  The Principle of Truth in Advertising
      Section 6.6.  The Principle of Indecent Exposure
      Section 6.7.  How to Define ArrayList
      Section 6.8.  Array Creation and Varargs
      Section 6.9.  Arrays as a Deprecated Type?
      Section 6.10.  Summing Up
          Chapter 7.  Reflection
      Section 7.1.  Generics for Reflection
      Section 7.2.  Reflected Types are Reifiable Types
      Section 7.3.  Reflection for Primitive Types
      Section 7.4.  A Generic Reflection Library
      Section 7.5.  Reflection for Generics
      Section 7.6.  Reflecting Generic Types
          Chapter 8.  Effective Generics
      Section 8.1.  Take Care when Calling Legacy Code
      Section 8.2.  Use Checked Collections to Enforce Security
      Section 8.3.  Specialize to Create Reifiable Types
      Section 8.4.  Maintain Binary Compatibility
          Chapter 9.  Design Patterns
      Section 9.1.  Visitor
      Section 9.2.  Interpreter
      Section 9.3.  Function
      Section 9.4.  Strategy
      Section 9.5.  Subject-Observer
    Part II:  Collections
          Chapter 10.  The Main Interfaces of the Java Collections Framework
          Chapter 11.  Preliminaries
      Section 11.1.  Iterable and Iterators
      Section 11.2.  Implementations
      Section 11.3.  Efficiency and the O-Notation
      Section 11.4.  Contracts
      Section 11.5.  Collections and Thread Safety
          Chapter 12.  The Collection Interface
      Section 12.1.  Using the Methods of Collection
      Section 12.2.  Implementing Collection
      Section 12.3.  Collection Constructors
          Chapter 13.  Sets
      Section 13.1.  Implementing Set
      Section 13.2.  SortedSet and NavigableSet
      Section 13.3.  Comparing Set Implementations
          Chapter 14.  Queues
      Section 14.1.  Using the Methods of Queue
      Section 14.2.  Implementing Queue
      Section 14.3.  BlockingQueue
      Section 14.4.  Deque
      Section 14.5.  Comparing Queue Implementations
          Chapter 15.  Lists
      Section 15.1.  Using the Methods of List
      Section 15.2.  Implementing List
      Section 15.3.  Comparing List Implementations
          Chapter 16.  Maps
      Section 16.1.  Using the Methods of Map
      Section 16.2.  Implementing Map
      Section 16.3.  SortedMap and NavigableMap
      Section 16.4.  ConcurrentMap
      Section 16.5.  ConcurrentNavigableMap
      Section 16.6.  Comparing Map Implementations
          Chapter 17.  The Collections Class
      Section 17.1.  Generic Algorithms
      Section 17.2.  Collection Factories
      Section 17.3.  Wrappers
      Section 17.4.  Other Methods
    About the Authors
    Colophon
    Index