Java Generics and Collections: Speed Up the Java Development Process
S**H
fabulous and concise
I recently went from about 0 Java experience to it being the only language (virtually) at a brand new job. I came from a heavy C/C++(STL)/Perl background (12 years).I bought about 6 Java books including the Sun ones (language spec + "effective programming", both great).This has been most useful as it's relatively short, covers up to Java 6 (sadly work we only use 5 as we're on mac os X). but it's like a quick ref to the "STL" of Java, at least how i see it .great boook
G**L
Good book, on a terriblly poorly implemented feature.
Coming to JAVA from C++, I was thinking, hey, I need to read up on JAVA Generics, they are like C++ Templates and will help me program better. Ok, yes they do help JAVA but in comparison to C++ Templates they are a terrible compromise by choosing to resolve down to the same basic non typed data in the JVM.On the book, this is an excellent read and you'll be able to use this feature, but after a very short while you'll wish for something better. If you are just getting around to JAVA, I recommend this book if you have to maintain old code, but if you get to write new stuff, start with Scala Programming in Scala: A Comprehensive Step-by-Step Guide, 2nd Edition, you can still call all those legacy JAVA libraries that your company wrote but you can skip this awful stage of the JAVA language.
M**V
To the point and Practical
This book has everything that you would need to know about Generics. Cutting it short, you"ll be an expert once you finish this book. Some portions (especially the beginning part) are really fast paced, but slow enough to grasped, which is why i said practical in my title. As a Developer for years, i recommend this book for anyone who's looking for quick and dirty book on generics, While quick and dirty sounds superficial, but believe me this book covers everything you'd ever need to know about generics (So yea all those purists can smile now :) ).When i first saw generics in Java i was befuddled to be honest, (to be erm, brutally honest, disappointed, since they are NOT like what really generics are capable, uh yea the Backwards compatibility logic..whatever). But still generics can considerably improve already existing code. There's a lot stuff out there with those list iterations and those nasty casts that you have to make... OK Enough if justification of Generics in Java, which btw isnt necessary, since your looking at this book anyways.Book has 2 sections1.) Generics (will explain everything about generics, with Design patterns that can be used and so forth).2.)Collections Framework (Quite intense, explains everything sufficiently)All in all, a great Buy.ThanksAnirudh
K**N
Five Stars
Excelent Condition!!!
J**H
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 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).
C**E
Excellent explanation of Java generics and its usage
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. IntroductionChapter 2. Subtyping and WildcardsChapter 3. Comparison and BoundsChapter 4. DeclarationsChapter 5. Evolution, Not RevolutionChapter 6. ReificationChapter 7. ReflectionChapter 8. Effective GenericsChapter 9. Design PatternsPart 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 FrameworkChapter 11. PreliminariesChapter 12. The Collection InterfaceChapter 13. SetsChapter 14. QueuesChapter 15. ListsChapter 16. MapsChapter 17. The Collections ClassOverall, this is a very good book on the subject of Java generics, and I highly recommend it.
W**R
Authoritative and Exhaustive
The book clearly focuses on the two subjects : Generics and Collections.The content is authoritative and exhaustive.
Y**O
bien
tres bien et detaille
M**L
Great foundation!
One could make the case that the source code is not the most current but that doesn't really matter because it is about the concepts and not the code per se. And if you wanna get going on generics and collections, start right here. It has helped me loads and put a lot of things in context.
X**N
A must-read for any professional Java developer
Although the front cover seems to suggest that Collections are given less attentions than Generics, that is not the case: the book is split in two roughly equal parts.The first part starts introducing Generics concepts but quickly delves into more specific matters shedding light on the darkest corners of generics.The second part describes the various Collections interfaces and discusses various class implementations, comparing technical details and computational complexity of their methods.This book is complete and very instructive. The authors show mastery of the topic providing lots of technical details as well as critical remarks on how generics evolved the way they did.However this is definitely not a book for beginners. Basically every sentence is meaningful to understand what follows. Sometimes important points are stated without the required emphasis.A gentler introduction to the concepts (especially those presented in the first chapters) would probably make the book more digestible.I had to read some parts several times to gain a full understanding of the material but it was worth it.
G**O
Excellent in-depth coverage
Designed for the Java experts and novices, this book dissects Generics from the syntax-level right down to bytecode and execution in the VM. Nearly talking point is reduced to a simple code fragment. A must-have for any developer working with generics. Only drawback: code examples are often laid out far away from the corresponding text, which is confusing.
Trustpilot
3 days ago
2 months ago