Recipe 7.16 Finally, Collections


Problem

You're having trouble keeping track of all these lists, sets, and iterators.

Solution

There's a pattern to it. See Figure 7-3 and Table 7-2.

Discussion

Figure 7-3, in the fashion of the package-level class diagrams in the O'Reilly classic Java in a Nutshell, shows the collection-based classes from package java.util.

Figure 7-3. The Collections Framework
figs/jcb2_0703.gif


See Also

The Javadoc documentation on Collections, Arrays, List, Set, and the classes that implement them provides more details than there's room for here. Table 7-2 may further help you to absorb the regularity of the Collections Framework.

Table 7-2. Java collections

Implementations

Interfaces

Resizable array

Hashed table

Linked list

Balanced tree

Set

 

HashSet

 

TreeSet

List

ArrayList, Vector

 

LinkList

 

Map

 

HashMap, HashTable

 

TreeMap




Java Cookbook
Java Cookbook, Second Edition
ISBN: 0596007019
EAN: 2147483647
Year: 2003
Pages: 409
Authors: Ian F Darwin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net