The Collections Framework defines several interfaces
Table of Collection Interfaces
Interface | Description |
Collection | Enables you to work with groups of objects; it is at the top of the collections |
hierarchy. | |
Deque | Extends Queue to handle a double-ended queue. (Added by Java SE 6.) |
List | Extends Collection to handle sequences (lists of objects). |
NavigableSet | Extends SortedSet to handle retrieval of elements based on closest-match |
searches. (Added by Java SE 6.) | |
Queue | Extends Collection to handle special types of lists in which elements are |
removed only from the head. | |
Set | Extends Collection to handle sets, which must contain unique elements. |
SortedSet | Extends Set to handle sorted sets. |
collections also use the Comparator, RandomAccess, Iterator, and ListIterator interfaces
The Collection Interface
The Collection interface is the foundation upon which the Collections Framework is built because it must be implemented by any class that defines a collection. Collection is a generic interface that has this declaration:
interface Collection<E>
Here, E specifies the type of objects that the collection will hold. Collection extends the Iterable interface. This means that all collections can be cycled through by use of the for-each style for loop. (Recall that only classes that implement Iterable can be cycled through by the for.)