collections
A Collection allows a group of objects to be treated as a single unit. Collections define a set of core interfaces. These are -
Collection
Set
List
SortedSet
Map
SortedMap
Collections also provide implementation for these interfaces.
Core Interfaces
The Object hierarchy of Core Interfaces defined in Collections is given below.
Figure: Core Interfaces of Collections
Collection Interface
The Collection interface is the root of Collection hierarchy, and is used for common functionality across all collections. There is no direct implementation of Collection interface.
Set Interface
The Set interface is used to represent a group of unique elements. It extends the Collection interface. The class HashSet implements the Set interface.
SortedSet Interface
The SortedSet interface extends the Set interface. It provides extra functionality of keeping the elements sorted. So SortedSet interface is used to represent collections consisting of unique, sorted elements. The class TreeSet is an implementation of interface SortedSet.
List Interface
The list interface extends the Collection interface to represent sequence of numbers in a fixed order. Classes ArrayList, Vector and LinkedList are implementation of List interface.
Map Interface
The Map Interface is a basic interface that is used to represent mapping of keys to values. Classes HashMap and Hashtable are implementations of Map interface.
SortedMap Interface
The SortedMap Interface extends Map interface and maintains their mappings in key order. The class TreeMap implements SortedMap interface.
The table below gives the list of Collection interfaces and the classes that implement them.
Interface Class Implementation
Set HashSet
SortedSet TreeSet
List ArrayList, Vector, LinkedList
Map HashMap, Hashtable
SortedMap TreeMap
Search News
News Categories
What's the News?
Post a link to something interesting from another site, or submit your own original writing for the Java community to read.
Most Popular News
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- Domain-driven design with Java EE 6
Published about 16-09-2009 | Rated 0 - MyEclipse 7.1: The Eclipse Standard for Web Services and Persistence
Submitted by Sonal | Rated +1 - HATS for Java
Submitted by Shyamala | Rated 0 - Sun Expands MySQL Identity
Published about 23-04-2009 | Rated 0








