Java Generics and Collections and over 450,000 other books are available for Amazon Kindle – Amazon’s new wireless reading device. Learn more

 

or
Sign in to turn on 1-Click ordering.
 
 
Express Checkout with PayPhrase
What's this? | Create PayPhrase
More Buying Choices
48 used & new from $17.00

Have one to sell? Sell yours here

or

Get a $8.30 Amazon.com Gift Card
 
   
Java Generics and Collections
 
 
Start reading Java Generics and Collections on your Kindle in under a minute.

Don’t have a Kindle? Get your Kindle here.
 
  
4.5 out of 5 stars  See all reviews (24 customer reviews)

List Price: $34.99
Price: $23.09 & eligible for FREE Super Saver Shipping on orders over $25. Details
You Save: $11.90 (34%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.

32 new from $19.50 16 used from $17.00

Formats

Amazon Price New from Used from
Kindle Edition $15.39  
Paperback $23.09  
Unknown Binding --  
Like this book? Find similar titles from O'Reilly and Partners in our O'Reilly Bookstore.

Best Value

Buy Java Generics and Collections and get Pragmatic Project Automation: How to Build, Deploy, and Monitor Java Apps at an additional 5% off Amazon.com's everyday low price.

Java Generics and Collections + Pragmatic Project Automation: How to Build, Deploy, and Monitor Java Apps
Buy Together Today: $41.87

Show availability and shipping details


Customers Who Bought This Item Also Bought


Editorial Reviews

Review

"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

Product Description

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


Product Details

  • Paperback: 288 pages
  • Publisher: O'Reilly Media; 1 edition (October 17, 2006)
  • Language: English
  • ISBN-10: 0596527756
  • ISBN-13: 978-0596527754
  • Product Dimensions: 9 x 7 x 0.7 inches
  • Shipping Weight: 12 ounces (View shipping rates and policies)
  • Average Customer Review: 4.5 out of 5 stars  See all reviews (24 customer reviews)
  • Amazon.com Sales Rank: #92,239 in Books (See Bestsellers in Books)

More About the Authors

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

Inside This Book (learn more)

What Do Customers Ultimately Buy After Viewing This Item?

Java Generics and Collections
62% buy the item featured on this page:
Java Generics and Collections 4.5 out of 5 stars (24)
$23.09
Effective Java (2nd Edition)
18% buy
Effective Java (2nd Edition) 4.9 out of 5 stars (39)
$39.51
Java Concurrency in Practice
11% buy
Java Concurrency in Practice 4.8 out of 5 stars (63)
$37.79
Core Java(TM), Volume I--Fundamentals (8th Edition)
5% buy
Core Java(TM), Volume I--Fundamentals (8th Edition) 4.3 out of 5 stars (19)
$37.79

Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
 
(18)

Your tags: Add your first tag
 

 

Customer Reviews

24 Reviews
5 star:
 (16)
4 star:
 (4)
3 star:
 (3)
2 star:
 (1)
1 star:    (0)
 
 
 
 
 
Average Customer Review
4.5 out of 5 stars (24 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most Helpful Customer Reviews

 
17 of 18 people found the following review helpful:
4.0 out of 5 stars Good, but could be better, February 6, 2007
By Gregory Guthrie (Fairfield, IA United States) - See all my reviews
(REAL NAME)   
Amazon Verified Purchase(What's this?)
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.
Help other customers find the most helpful reviews  
Was this review helpful to you? Yes No


 
12 of 12 people found the following review helpful:
5.0 out of 5 stars Excellent explanation of Java generics and its usage, December 3, 2006
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. Chapter 6 explains how the same design that leads to ease of evolution also necessarily leads to a few rough edges in the treatment of casts, exceptions, and arrays. The fit between generics and arrays is the worst rough corner of the language, so two principles are formulated to help work around the problems. Chapter 7 explains new features that relate generics and reflection, including the newly generified type "Class T" and additions to the Java library that support reflection of generic types. Chapter 8 contains advice on how to use generics effectively in practical coding. Checked collections, security issues, specialized classes, and binary compatibility are all considered. Chapter 9 presents five extended examples, looking at how generics affect five well-known design patterns: Visitor, Interpreter, Function, Strategy, and Subject-Observer. The following is a list of chapters in part one:

Chapter 1. Introduction
Chapter 2. Subtyping and Wildcards
Chapter 3. Comparison and Bounds
Chapter 4. Declarations
Chapter 5. Evolution, Not Revolution
Chapter 6. Reification
Chapter 7. Reflection
Chapter 8. Effective Generics
Chapter 9. Design Patterns

Part II is about the Java Collections Framework, which is a set of interfaces and classes in the packages java.util and java.util.concurrent. They provide client programs with various models of how to organize their objects, and various implementations of each model. These models are sometimes called abstract data types, and they are needed because different programs need different ways of organizing their objects. In one situation, you might want to organize your program's objects in a sequential list because their ordering is important and there are duplicates. In another, a set might be the right data type because now ordering is unimportant and you want to discard the duplicates. These two data types and others are represented by different interfaces in the Collections Framework, and there are examples of their use in chapter 10. However, none of these data types has a single "best" implementation--that is, one implementation that is better than all the others for all the operations. For example, a linked list may be better than an array implementation of lists for inserting and removing elements from the middle, but much worse for random access. So choosing the right implementation for a program involves knowing how it will be used as well as what is available.

This part of the book starts with an overview of the Framework and then looks in detail at each of the main interfaces and the standard implementations of them. Finally the book examines the special-purpose implementation and generic algorithms provided in the Collections class. The following is a list of chapters in part two:

Chapter 10. The Main Interfaces of the Java Collections Framework
Chapter 11. Preliminaries
Chapter 12. The Collection Interface
Chapter 13. Sets
Chapter 14. Queues
Chapter 15. Lists
Chapter 16. Maps
Chapter 17. The Collections Class

Overall, this is a very good book on the subject of Java generics, and I highly recommend it.
Help other customers find the most helpful reviews  
Was this review helpful to you? Yes No


 
7 of 7 people found the following review helpful:
5.0 out of 5 stars Everything you ever wanted to know about collections and generics..., December 16, 2006
By Thomas Duff "Duffbert" (Portland, OR United States) - See all my reviews
(TOP 50 REVIEWER)    (REAL NAME)    (VINE VOICE)   
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...

Contents:
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...
Help other customers find the most helpful reviews  
Was this review helpful to you? Yes No

Share your thoughts with other customers: Create your own review
 
 
 
Most Recent Customer Reviews

2.0 out of 5 stars Not worth the price of purchase
This is a very basic introduction to the Java Collections Framework and simple use of generics. Emphasis on *simple*. Read more
Published 3 months ago by Paul J. Ste Marie

5.0 out of 5 stars Concise and useful.
This book is very useful.

It is in fact, ridiculously concise. It may seem like a flimsy little workbook, but somehow a ton of information is fit in it. Read more
Published 7 months ago by S. McDonald

3.0 out of 5 stars Some good information
While the author spends too much time on what he thinks Java should be and what Sun needs to do to fix it, there is a lot of good and useful data to be had from the text.
Published 10 months ago by Andre Untiedt

4.0 out of 5 stars Complete and precise in contents, somewhat confusing in presentation
You will find everything you need to know in this thorough book. But be prepared the most advanced chapters are right at the beginning: A tough start easing off to light reading... Read more
Published 15 months ago by ws__

5.0 out of 5 stars Explains the inexplicable
There are some difficult issues with Java Generics. This book does an excellent job explaining them. Read more
Published 17 months ago by Frank Kieviet

4.0 out of 5 stars Very Thorough, Maybe Too Much So
This book has very in-depth information on Java generics, but some of the details are just not that interesting to the practical developer. Read more
Published 17 months ago by bub hub

5.0 out of 5 stars Excellent coverage of generics
The authors provide detailed examples of capabilities provided by Generics. There are plenty of examples to illustrate various concepts. Read more
Published 22 months ago by computer guy

5.0 out of 5 stars Excellent Book on Generics and Collections
This a very good book on Collections and Generics. It is very readable and very well laid out and organized. Read more
Published 22 months ago by Indikos

3.0 out of 5 stars Average, Nothing Exciting... not much more than its online alternative...
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... Read more
Published on March 11, 2008 by J. Brutto

5.0 out of 5 stars Java Generics and Collections and Bears, Oh My!
Generics in Java have some non-trivial aspects, and this book does a great job of explaining when you need to use what in a comprehensive and concise manner. Read more
Published on February 20, 2008 by Eric Jain

Only search this product's reviews



Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Active discussions in related forums
Search Customer Discussions
Search all Amazon discussions
   


Listmania!


So You'd Like to...


Create a guide

Product Information from the Amapedia Community

Beta (What's this?)


Look for Similar Items by Category


Look for Similar Items by Subject

 

Feedback

If you need help or have a question for Customer Service, contact us.
 Would you like to update product info or give feedback on images?
Is there any other feedback you would like to provide?

Your comments can help make our site better for everyone.


Your Recent History

 (What's this?)

After viewing product detail pages or search results, look here to find an easy way to navigate back to pages you are interested in.