Tuesday, January 09, 2007

Java Generics (and Collections)

I just finished reading the Java Generics book by Maurice Naftalin and Philip Wadler. I already had a good handle on generics as I have been using them for a couple years, but in general I had a difficult time explaining the more complex uses to other developers. So, I picked up this book as a reference to help me explain/justify the way I have been doing things. The first half of the book is specific to generics while the second half of the book is about the Collections framework. The book does a good job covering generics in collections, generic methods, type tokens, reflection, and recursive generic definitions. Overall, I thought the book was written very well an organized in a fashion that makes it very readable. I thought the coverage of Generics was very clear and concise, and I would recommend this book for people wanting to learn about Generics or as a good reference for the more experienced. At first, I thought the Collections half of the book was basically there as filler material, but I was quite surprised to actually find it relevant. The book very thoroughly covers The Collections interfaces and their implementations which are provided in the standard JDK including Java 6. The book even provides several handy tables comparing each implementation's time complexity. Just in case you didn't know, another spectacular Java Generics resource is Angelika Langer's Java Generics FAQ.