Java Reference
In-Depth Information
The Collections Framework
Problem
You're having trouble keeping track of all these lists, sets, and iterators.
Solution
There's a pattern to it. See Figure 7-1 and Table 7-1 .
Discussion
List , Set , and Map are the three fundamental data structures of the Collections Framework.
List and Set are both sequences, with the difference that List preserves order and allows
duplicate entries, whereas Set , true to the mathematical concept behind it, does not. Map is a
key/value store, also known as a “hash,” a “dictionary,” or an “associative store.”
Figure 7-1 , 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 .
See Also
The javadoc documentation on Collections , Arrays , List , Set , and the classes that imple-
ment them provides more details than there's room for here. Table 7-1 may further help you
to absorb the regularity of the Collections Framework.
Table 7-1. Java collections
Interfaces Resizable array Hashed table
Linked list Balanced tree
Set
HashSet
TreeSet
List
ArrayList, Vector
LinkList
Map
HashMap, HashTable
TreeMap
Search WWH ::




Custom Search