|
The term "collections" refers to the notion of objects that contain or manage other objects. Most developers are familiar with the basic collections, including the classic array (such as String[]) or the built-in Java classes (such as java.util.Hashtable). The introduction of a rich Java Collections Framework in Java 2 (JDK 1.2) brought a standardized implementation of classes for expressing more complex relationships. The Apache Jakarta Commons Collections project adds even more capability, as described in this chapter. Table 11-1 compares some of the key differences between basic collection types. When possible, you should try to rely on the interfaces shown, not on the underlying implementation. For example, even if you have marked a HashMap as typed, sorted, and unmodifiable, you should still interface with it as a java.util.Map whenever possible:
java.util.Map myMap = new java.util.HashMap(); For more information on the built-in JDK 1.4 collections, see http://java.sun.com/j2se/1.4.2/docs/guide/collections/reference.html. Note that this chapter does not duplicate information included in the default JDK documentationfor example, the Stack and SortedMap interfaces are concepts covered as part of the standard Java collection interface. The meaning of each column heading in Table 11-1 is as follows:
|
|