Programming Books C Java PHP Python Learn more Browse Programming Books
Java Generics and Collections and over one million other books are available for Amazon Kindle. Learn more
Buy New
  • List Price: $34.99
  • Save: $4.91 (14%)
FREE Shipping on orders over $35.
In Stock.
Ships from and sold by
Gift-wrap available.
Add to Cart
Trade in your item
Get a $2.75
Gift Card.
Have one to sell? Sell on Amazon
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See all 2 images

Java Generics and Collections Paperback – October 24, 2006

See all 4 formats and editions Hide other formats and editions
Amazon Price New from Used from
"Please retry"
"Please retry"
$19.99 $11.34

Frequently Bought Together

Java Generics and Collections + Java Concurrency in Practice + Effective Java (2nd Edition)
Price for all three: $110.19

Buy the selected items together


Shop the New Digital Design Bookstore
Check out the Digital Design Bookstore, a new hub for photographers, art directors, illustrators, web developers, and other creative individuals to find highly rated and highly relevant career resources. Shop books on web development and graphic design, or check out blog posts by authors and thought-leaders in the design industry. Shop now

Product Details

  • Paperback: 286 pages
  • Publisher: O'Reilly Media; 1 edition (October 24, 2006)
  • Language: English
  • ISBN-10: 0596527756
  • ISBN-13: 978-0596527754
  • Product Dimensions: 0.7 x 6 x 10.2 inches
  • Shipping Weight: 12 ounces (View shipping rates and policies)
  • Average Customer Review: 4.2 out of 5 stars  See all reviews (28 customer reviews)
  • Amazon Best Sellers Rank: #294,406 in Books (See Top 100 in Books)

Editorial Reviews


"This is a very good book on two fairly focused topics - generics and collections. If you plan to make best use of either or both, buy a copy." - Ian Elliot, VSJ, April 2007

Book Description

Master The New Features of Java

More About the Authors

Discover books, learn about writers, read author blogs, and more.

Customer Reviews

4.2 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See all 28 customer reviews
Can't possibly go wrong with this one.
Finally the book examines the special-purpose implementation and generic algorithms provided in the Collections class.
This book does an excellent job explaining them.
Frank Kieviet

Most Helpful Customer Reviews

19 of 19 people found the following review helpful By calvinnme HALL OF FAMETOP 1000 REVIEWERVINE VOICE on December 3, 2006
Format: Paperback
The intent of Generics is make your Java code type-safer. While Java is a strongly typed language, it lacks type-safety when it comes to using collections. Generics were added to the Java programming language in 2004 as part of J2SE 5.0. Unlike C++ templates, generic Java code generates only one compiled version of a generic class. Generic Java classes can only use object types as type parameters -- primitive types are not allowed. Thus a List of type Integer, which uses a primitive wrapper class is legal, while a List of type int is not legal.

Part I of this book provides a thorough introduction to generics. Generics are a powerful, and sometimes controversial, new feature of the Java programming language. This part of the book describes generics, using the Collections Framework as a source of examples.

The first five chapters focus on the fundamentals of generics. Chapter 1 gives an overview of generics and other new features in Java 5, including boxing, foreach loops, and functions with a variable number of arguments. Chapter 2 reviews how subtyping works and explains how wildcards let you use subtyping in connection with generics. Chapter 3 describes how generics work with the Comparable interface, which requires a notion of bounds on type variables. Chapter 4 looks at how generics work with various declarations, including constructors, static members, and nested classes. Chapter 5 explains how to evolve legacy code to exploit generics, and how ease of evolution is a key advantage of the design of generics in Java. Once you have these five chapters under your belt, you will be able to use generics effectively in most basic situations.

The next four chapters treat advanced topics.
Read more ›
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
25 of 27 people found the following review helpful By Gregory Guthrie on February 6, 2007
Format: Paperback Verified Purchase
Java generics are a welcome and important addition to the Java language, but because of their Erasure based implementation, they are somewhat limited and confusing to use.

This book is good in that it does cover many of the issues, and some interesting applications, but is I think limited in both explanations, and examples. Their section on Generics and Design patterns is a welcome one, but very short, and not very long on rationale or depth on other applications. If the examples they show is the only impact of generics on design patterns, something is wrong!

The standard Generics tutorials by Bracha and Langer, and the IBM DeveloperWorks series by Allen are more complete, and more descriptive, and free! I found the lumping of collections together with Generics ok, but a bit indicative that they ran out of real generics material. They are also IMHO a bit defensive on the long contested Erasure approach, but do explain their viewpoint well. They fault the C# and C++ approaches too quickly, noting the problems but not the corresponding solutions provided. Hopefully next versions of Java will (soon) provide reified versions of generics, it looks like it is in process now.

I did think it a worthwhile read, but not as much as expected.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
Format: Paperback
This is one of the most in-depth books on the Java topics of generics and collections... Java Generics and Collections, by Maurice Naftalin and Philip Wadler. It covers the gamut from the basics to advanced...


Part 1 - Generics: Introduction; Subtyping and Wildcards; Comparison and Bounds; Declarations; Evolution, Not Revolution; Reification; Reflection; Effective Generics; Design Patterns

Part 2 - Collections: The Main Interfaces of the Java Collections Framework; Preliminaries; The Collection Interface; Sets; Queues; Lists; Maps; The Collections Class; Index

There have been quite a few books out that deal with the new Java 5.0 features, of which generics and collections are the featured items. But few go past the basics and common usage. Naftalin and Wadler devote this entire book to just those new features, which means they can spend a lot more time diving into the guts of how they work. There are nice "before generics" and "after generics" comparisons in the one section, so you can see how current coding styles can be enhanced and modified. I also liked how some basic design patterns were used to show how generics can be incorporated into standard designs. The collections material is just as helpful. Each type of collection is covered in detail, both for the reference on how it's coded as well as diagrams to show the architecture of that type of list. Again, when you get done with the section, there shouldn't be too many questions and issues surrounding collections that you can't answer or at least figure out.

Solid material, and definitely a title you'll want to have around when you start playing around with generics and collections...
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
11 of 12 people found the following review helpful By J. Brutto on March 11, 2008
Format: Paperback Verified Purchase
It's a decent reference and a great read to go over generics and the collections framework. But don't get me wrong, it's nothing you can't get from just reading the Sun-provided API documentation or tutorials covering the topics.

It's comprehensive, sure... but the examples lean to near overkill on each topic in some areas. In other areas, there just isn't enough information or example code to really drive home the ideas.

It's average and worth the read. Not worth keeping around, though. It's one of those "read-once-then-give-it-to-a-friend" books. Like I said, though: you should definitely read this book if you're looking for more information on these topics. You'll just find yourself hitting resources online for more information in areas you are particularly interested in (concurrency w/ collections, for example).
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Customer Images

Most Recent Customer Reviews


What Other Items Do Customers Buy After Viewing This Item?