Java Generics and Collections (Google eBook)

Front Cover
"O'Reilly Media, Inc.", Oct 17, 2006 - Computers - 286 pages
13 Reviews

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

Java Generics and Collections covers everything from the mostbasic uses of generics to the strangest corner cases. It teaches youeverything you need to know about the collections libraries, so you'llalways know which collection is appropriate for any given task, andhow 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 andgeneric 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 anew level. If you want to take your software development practice toa new level, this book is essential reading.

Philip Wadler is Professor of Theoretical Computer Science at theUniversity of Edinburgh, where his research focuses on the design ofprogramming languages. He is a co-designer of GJ, work thatbecame 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 thetopic, it provides a crystal clear tutorial that starts with thebasics and ends leaving the reader with a deep understanding of boththe use and design of generics."
Gilad Bracha, Java Generics Lead, Sun Microsystems


What people are saying - Write a review

User ratings

5 stars
4 stars
3 stars
2 stars
1 star

Review: Java Generics and Collections

User Review  - Narendra Pathai - Goodreads

Great book that goes in depth of Java Generics which feels awkward initially to someone coming from other languages. Read full review

Review: Java Generics and Collections

User Review  - Misha Ring - Goodreads

Finally, i've read this book! I have a point that i should finish every book that i've started to read. This book was an exception, because i wasn't able to finish it for a few years. I had all sorts ... Read full review


Subtyping and Wildcards
Comparison and Bounds
Evolution Not Revolution
Effective Generics
The Collection Interface
The Collections Class

Design Patterns

Common terms and phrases

Popular passages

Page xiv - If I have seen farther than others it is because I have stood on the shoulders of giants," it was not mere modesty but fact.
Page xvii - O'Reilly Network Safari Bookshelf. Safari offers a solution that's better than e-books. It's a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at Acknowledgments The...
Page xvi - Java uses unchecked or unsafe operations. Note: Recompile with -XI int: unchecked for details. This warning can be eliminated using generic types discussed in Chapter 2 1 , "Generics.
Page 19 - JDK 1.5, the method changed to: public static <T> void copy(List<? super T> dest, List<? extends T> src...

References to this book

Dirk W. Hoffmann
No preview available - 2008

About the author (2006)

Maurice Naftalin has over 30 years' experience in IT - as a developer, designer, architect, manager, teacher and author. Naftalin, a certified Java Programmer, has worked in every release of Java to date. His experience in Java and business give him a unique perspective on the fundamental change that comes with introducing Lambda expressions in Java SE 8. Naftalin is a frequent presenter at conferences worldwide, including the annual JavaOne. He runs a popular tutorial site in collaboration with Oracle's development team,, focused on the new language features in Java 8.

Philip Wadler is a professor of theoretical computer science at the University of Edinburgh, Scotland, where his research focuses on functional and logic programming. He co-authored the Generic Java standard that became the basis for generics in Sun's Java 5.0 and also contributed to the XQuery language standard base. Professor Wadler received his Ph.D., in computer science from Carnegie-Mellon University and co-wrote "Introduction to Functional Programming" (Prentice-Hall).