The Collections Framework provides a well-designed set of interfaces and classes used for storing and manipulating groups of data into a single unit.
Introduction to collection Implementations
The Collections Framework provides a
well-designed set of interfaces and classes used for storing and manipulating groups
of data into a single unit. The collections framework is a unified architecture
which is used to represent
and manipulate collections. The framework allows the collections to get manipulated independently as well as reduces programming effort for increasing
performance.
It includes implementations of interfaces, and algorithms included
in it to manipulate them. Basically it is a unified architecture that consists
the following collections:
Implementations are the reusable data objects used to store collections, which implement the collection interfaces. Implementations are also responsible for documenting the operations which they support. All of the general-purpose implementations of the Java platform support all of the optional operations. The following kinds of implementations are described below:
- General-purpose implementations: These are
the most commonly used implementations, designed for performing all optional
operations contained within the defined interfaces. They are summarized in the table below.
Interfaces | Implementations | |||
---|---|---|---|---|
Hash table | Tree | Linked list | Hash table + Linked list | |
Set |
HashSet |
TreeSet |
LinkedHashSet |
|
List |
LinkedList |
|||
Queue |
||||
Map |
HashMap |
TreeMap |
LinkedHashMap |
-
The Java Collections Framework provides several general-purpose implementations of the
Set
,List
, andMap
interfaces. Each of the general-purpose implementations provides all optional operations contained in its interface. All permit null elements, keys, and values.
- Special-purpose implementations: These are
designed to use in special situations and display nonstandard performance
characteristics, usage restrictions, or behavior.
- Concurrent implementations: These are
designed to support high concurrency. These implementations are part of the java.util.concurrent
package.
- Wrapper implementations: These are used in
combination with other types of implementations.
- Convenience implementations: These are
mini-implementations, typically made via static factory methods, that
provide convenient, efficient alternatives to general-purpose
implementations for special collections.
- Abstract implementations: These are implementations that facilitate the construction of custom implementations.
The following description describes the categories in which the Collection Framework interfaces are implemented.
The Set implementations are grouped into
general-purpose and special-purpose implementations. List implementations
are grouped into general-purpose and special-purpose implementations. Map
implementations are grouped into general-purpose, special-purpose, and
concurrent implementations. The Queue implementations are grouped into
general-purpose and concurrent implementations.