O'Reilly logo

Java Cookbook by Ian F. Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 Java in a Nutshell books, shows the collection-based classes from package java.util.

The Collections Framework

Figure 7-3. The Collections Framework

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

Interfaces

Implementations

Resizable array

Hashed table

Linked list

Balanced tree

Set
 
HashSet
 
TreeSet
List
ArrayList, Vector
 
LinkList
 
Map
 
HashMap, Hashtable
 
TreeMap

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required