Collections in Java
A collection is an object that groups multiple
elements into a single unit. Collections are used to store, retrieve,
manipulate, and communicate aggregate data.
A collections
framework is a unified architecture for representing and manipulating
collections. All collections frameworks contain the following:
- Interfaces: Interfaces
allow collections to be manipulated independently of the details of their
representation.
- Implementations: These
are the concrete implementations of the collection interfaces. They
represent reusable data structures.
- Algorithms: Are the methods that perform useful operations,
for example searching and sorting, on objects that implement collection
interfaces. The algorithms are polymorphic: that is, the same method can
be used on many different implementations the collection interface.
Benefits of the Java
Collections Framework
- Reduces programming effort
- Increases program speed and quality
- Interoperability among unrelated APIs.
- Reduces effort to learn and to use new APIs
- Reduces effort to design new APIs
- Increases
software reuse