Java Collections: A great reference and learning tool

Java's collections framework can be difficult to understand and use. Read our review of the book <i>Java Collections</i> and see if it could be the key you need to unlock this often-confounding part of Java.

Java Collections is a handy book for developers who manage data in their Java programs. Too often, errors are made from not knowing enough about the class you are using—for example, can an item have a null value? Does the index start at zero or at one? Is this data space a fixed size, or can it grow? Java Collections provides these answers and more. Published by Apress, the book offers 422 pages of information and sample code and sells for $49.95.

What's in the book?
The Java Collections text is divided into three parts and consists of 17 chapters. Part I begins with an overview of the Java Collections Framework and then covers historical Collection Classes: arrays, vector and stack classes, the enumeration interface, the dictionary, hashtable, and properties classes and the BitSet Class.

Part II covers the Collections Framework. This includes sets, lists, maps, sorting, special Collections support, array algorithm support, custom implementations, compatibility issues, and advanced usages.

Part III covers the alternative collection libraries: JGL Libraries, util.concurrent, and Colt.

The book also includes several valuable appendices: Collections API Reference, Collections Resources, and a section on Generic Types.

Is this text for all programmers or just beginners?
This book is not for a novice Java programmer nor is it recommended for developers who are unfamiliar with data structures. The text does not teach Java or data structures. Some previous data structure knowledge aids you in understanding the concepts behind the classes and in choosing the appropriate class to handle data within your application. The author, John Zukowski, describes what is needed to explain the API but does not go in depth.

What makes this book worthwhile?
Java Collections is not a book you’d pick up and read from cover to cover. It is loaded with information and is not light reading. Your best bet is to read the sections applicable to the class you have in mind for your application. A lot (but not all) of the information provided in the book can be found in the JAVA Specification for the API, but the book’s explanations are easier to understand than the specs.

The book includes useful tips and warnings within the class descriptions. Many of these tips are not part of the specifications. Some are as simple as highlighting what exception will be thrown if you misuse a class, but other tips are not as obvious, addressing things like syntax differences, alternative techniques, and where to find more information on a subject (either in the text or on the Web). In addition, the author offers tips on performance and provides recommendations throughout the book to help you understand the performance implications based on how you might use a particular class.

Java Collections contains great examples to illustrate concepts. Small examples are given throughout the text. Some examples show the result of a method on a particular set of data (showing input and output after the method is applied to the data). Other examples are partial code snippets and complete programs. The sample code does not come on a CD with the book, but it is available through the publisher’s Web site.

What’s the end opinion?
Java Collections is a good text for experienced developers who have some knowledge of data structures. If you fall into this category, Java Collections can help you get familiar with the Java Collections Framework, guide you in using the library correctly, and help you identify and avoid some common mistakes. In addition, it makes a great reference for the APIs. Although some of the information is redundant with the JAVA Specification, the book is easier to navigate and understand. Add to this the extra tips, and Java Collections is well worth the investment. You’ll definitely refer to it again and again.

What Java resources do you recommend?
Is there a Java resource you’ve found especially useful? What suggestions do you have for members looking for more information on Java? Send us an e-mail with your thoughts and suggestions or post a comment below.


Editor's Picks