Summary of Interfaces
The core collection interfaces are the foundation of the Java Collections Framework.
The Java Collections Framework hierarchy consists of two distinct interface trees:
- The first tree starts with the
Collectioninterface, which provides for the basic functionality used by all collections, such as
removemethods. Its subinterfaces —
Queue— provide for more specialized collections.
Setinterface does not allow duplicate elements. This can be useful for storing collections such as a deck of cards or student records. The
Setinterface has a subinterface,
SortedSet, that provides for ordering of elements in the set.
Listinterface provides for an ordered collection, for situations in which you need precise control over where each element is inserted. You can retrieve elements from a
Listby their exact position.
Queueinterface enables additional insertion, extraction, and inspection operations. Elements in a
Queueare typically ordered in on a FIFO basis.
Dequeinterface enables insertion, deletion, and inspection operations at both the ends. Elements in a
Dequecan be used in both LIFO and FIFO.
The second tree starts with the
Mapinterface, which maps keys and values similar to a
SortedMap, maintains its key-value pairs in ascending order or in an order specified by a
These interfaces allow collections to be manipulated independently of the details of their representation.