Java Reference
In-Depth Information
Sidebar 3.1 Collections
Collections are objects that encapsulate other objects, which are called items.
Collections are commonly classified in three categories:
A list is just a group of items.
A set is a list that contains no duplicates.
A map is a set of key-value pairs.
The Java Collections Framework provides a set of interfaces for storing and
manipulating groups of data as depicted in the figure below.
<< Interface >>
Collection
<< Interface >>
Map
<< Interface >>
List
<< Interface >>
Set
<< Interface >>
SortedMap
<< Interface >>
SortedSet
SortedSet and SortedMap represent collections of items ordered according to
criteria defined in the items' classes. For this purpose, item classes must imple-
ment the comparable interface.
The Java Collections Framework also provides a set of concrete classes that
implement the collection interfaces, as summarized in the table below.
Interface
Class
Description
Set
HashSet
The set is implemented as a hash table
SortedSet
TreeSet
The sorted set is implemented as a balanced
binary tree
List
ArrayList
The list is implemented as a resizable array
List
LinkedList
The list is implemented as a doubly linked list
Map
HashMap
The map is implemented as a hash table
SortedMap
TreeMap
The sorted map is implemented as a balanced
binary tree
set of activities to be processed over a certain period of time, evaluates their
activation and termination time, and measures their performance.
Decision point
How do we model a scheduling problem?
 
Search WWH ::




Custom Search