Press Release: October 17, 2006
Java Generics and Collections: Speed Up the Java Development Process
Sebastopol, CA--The support of generics is the most significant change to Java since the addition of inner classes in Java 1.2, and some would say the most significant change to the language ever. Generics are a powerful, occasionally controversial, feature of the language. Together with the greatly expanded collection libraries, they've tremendously increased the power of Java 5 and Java 6. But the libraries have also confused developers who haven't known how to take advantage of these new features. In Java Generics and Collections (O'Reilly, US $34.99), authors Maurice Naftalin and Philip Wadler cover everything from the most basic uses of generics to a comprehensive introduction to Collections Framework, including how and when to use each collection for any given task.
"In a few years, lots of folks will know how to use generics, and it will be easy to learn," says Wadler. "But just for now, what is needed is a good book." A professor of theoretical computer science at the University of Edinburgh, Wadler is a co-designer of GJ, the work that became the basis for generics in Sun's Java 5.0. His coauthor, Naftalin, is technical director for a software consultancy in the UK, and has taught both basic and advanced levels of Java since 1998.
"I was involved in the development of Java generics and I wanted to be sure there was an introduction that would explain the ideas in depth," Wadler explains. "A few good examples can make a world of difference. I wanted to write down the examples that others would use--to teach the teachers."
According to Wadler, a mastery of generics is not only essential for Java developers, but other developers as well. As he points out, "There's a big debate right now about static typing. Some people say that static typing is dead, and dynamic languages (like Python and Ruby) will dominate. But types are the best tool we have to find bugs in programs without running them, and I think they will play an increasingly important role. Generics have an absolutely central role to play here, because they make static types much more flexible, and they often give the best of both worlds--the error-checking offered by static types with the adaptability of dynamic languages. Generics are definitely the coming thing. They are in Java, and they are also in C# and .NET. So it's a subject that everyone will need to know about."
The first part of the book describes generics, using the Collections Framework as a source of examples. Part II begins with an overview of the Framework and then looks in detail at each of the main interfaces and standard implementations of them. And finally, readers will look at the special-purpose implementation and generic algorithms provided in the Collections class. Topics include:
- Fundamentals of generics: types of parameters and generic methods
- Boxing and unboxing, foreach loops, varargs, and other new features
- 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 implementation
- Concurrent programming and thread safety with collections
- Performance implications of different collections
"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
- More information about the book, including table of contents, index, author bios, and samples
- A cover graphic in JPEG format
Maurice Naftalin and Philip Wadler
ISBN: 0-596-52775-6, 273 pages, $34.99 US, $48.99 CA
For almost 40 years, O’Reilly Media has provided technology and business training, knowledge, and insight to help companies succeed. Our unique network of experts and innovators share their knowledge and expertise through the company’s Safari training and learning platform and at O’Reilly conferences. As a SaaS learning platform, Safari delivers highly topical and comprehensive technology and business learning solutions to millions of users across enterprise, consumer, and university channels. For more information visit oreilly.com.
Return to: O'Reilly Press Room