A Collection allows a group of objects to be treated as a single unit. Collections define a set of core interfaces. These are –
Collections also provide implementation for these interfaces.
Core Interfaces :
The Object hierarchy of Core Interfaces defined in Collections is given below.
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.
|List||ArrayList, Vector, LinkedList|