Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

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

Subscriber Reviews

Average Rating: 4 out of 5 rating Based on 4 Ratings

"Excellent depth" - by Sameer on 10-AUG-2012
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
I found this book to be a difficult read, because of the technical depth covered. Its a great book for someone who really wants the nitty gritties on generics in java
Report as Inappropriate

"Good coverage of generics" - by Christopher on 14-MAR-2011
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
For the part on generics, this book is excellent.  It does a great job of explaining generics, and so on.  While much of that type of stuff can be found in other books too (such as "The Java Programming Language"), this explains it in a different way that expands your understand.  Even more important, however, is the many sections where the authors discuss the strengths & weaknesses of generics with erasure and--this is the key part--how to best work around the weaknesses *and* take advantage of their power.  The application of generics to patterns was quite unique and inspired ideas for applying generics in my own code.

The collections section is decent as well, but not as needed as the generics section.  I would assume it was included to expand the meat of the book.  Nevertheless, there are some good insights there.  If you are not familiar with Java collections, their coverage is a recommended read.  If you are, you might want to look at the sections of some classes that you might not now of (like the NavigableMap).

Report as Inappropriate

Table of Contents

 

Extras

The publisher has provided additional content related to this title.


Description
Content

Visit the catalog page for Java Generics and Collections

  • Catalog Page

Visit the errata page for Java Generics and Collections

  • Errata

Download the supplemental electronic content for Java Generics and Collections

  • Supplemental Content