Introduction to Collection Framework

Posted by

The java collection framework provides a set of standard utility classes for managing various kind of collections.The core framework is provided in java.util package. A collection allows a group of objects to be treated as a single unit.Objects can be retrieved, stored and manipulated as elements of a collection.
The java collection framework consists of  three main parts as shown in following image.

Core Collection Interfaces

Interface Description Concrete Class
Collection A basic interface that defines the normal operations that allow a collection of objects to be maintained or handled as a single unit.
Set The Set interface extends the Collection
interface to represent its mathematical
namesake: a set of unique elements.
HashSet
LinkedHashSet
SortedSet The SortedSet interface extends the Set
interface to provide the required functionality
for maintaining a set in which the elements
are stored in some sorted order.
TreeSet
NavigableSet The NavigableSet interface extends and
replaces the SortedSet interface to maintain a
sorted set, and should be the preferred choice
in new code.
TreeSet
List The List interface extends the Collection
interface to maintain a sequence of elements
that can contain duplicates.
ArrayList
Vector
LinkedList
Queue The Queue interface extends the Collection
interface to maintain a collection whose
elements need to be processed in some way,
i.e., insertion at one end and removal at the
other, usually as FIFO (First-In, First-Out).
PriorityQueue
LinkedList
Deque The Deque interface extends the Queue interface
to maintain a queue whose elements can be
processed at both ends.
ArrayDeque
LinkedList
Map A basic interface that defines operations for
maintaining mappings of keys to values.
HashMap
Hashtable
LinkedHashMap
SortedMap The SortedMap interface extends the Map
interface for maps that maintain their
mappings sorted in key order.
TreeMap
NavigableMap The NavigableMap interface extends and
replaces the SortedMap interface for sorted
maps.
TreeMap

Note- Map interface does not extend Collection interface because conceptually , a map is not a collection.Map does not contain elements, it contains mappings from a set of key(objects) to a set of value objects.

Leave a Reply