Chapter 5. Collections
Introduction
Java 2 Standard Edition (J2SE) introduced the Collections API—a
dramatic improvement over Vector
and
Hashtable
in Java 1.1. This new API provides
Set
, List
,
Map
, and Iterator
interfaces
with various implementations addressing different needs for different
applications. Despite the additions and improvements, there are still
gaps in the Java’s Collections
API—functionality that is addressed by a supplemental library,
Jakarta Commons Collections. Most of the features introduced in
Jakarta Commons Collections are easily anticipated extensions of the
Java 2 platform: a reversible Comparator
or a
Bag
interface, for example. Other concepts in
Commons Collections are innovative additions to the
J2SE—predicated collections, self-validating collections, set
operations, and lazy collections using transformers. Commons
Collections 3.0 also introduces the concept of functors (see Chapter 4).
Java 5.0 (a.k.a. Tiger) has introduced a number of new language
features and improvements to the Collections API. A
Queue
class and type-safe generics are two major
additions that will become available to most programmers with the
production-ready release of 5.0. Some recipes in this chapter
introduce utilities that overlap the functionality of 5.0, and, if a
recipe introduces a utility with an analog in 5.0, an effort has been
made to identify any opportunity to achieve the same result with new
5.0 classes and features.
Get Jakarta Commons Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.