Let’s discuss one of the main concept of Java, (i.e. Collections Framework),
- What is and why collections ?
- Core collection interfaces
- Custom Implementations
Let’s start in the topics in depth below,
What is a collection ?
- A “collection” is an object–sometimes called a container– is simply an object that groups multiple elements into a single unit.
- A Collections framework is a unified architecture fro representing and manipulating collections.
- Collections are used to store, manipulate, retrieve and communicate aggregate data.
- All collections framework contain the following:
Benefits of Collection Framework
- Reduces programming effort
- Increases program speed and quality
- Allows interoperability among unrelated APIs
- The collection interfaces are the vernacular by which APIs pass collections back and forth
- Collection interfaces are abstract data types that represent collections
- collection interfaces are in the form of java interfaces
- Interfaces allow collections to be manipulated independently of the implementation details of their representation
- Polymorphic behavior.
Types of Implementations
- General-purpose implementations
- Special-purpose implementations
- Concurrent implementations
- Wrapper implementations
- Convenience implementations
- Abstract implementations
Implementations are the data objects used to store collections, which implement the interfaces. Each of the general-purpose implementations provides all optional operations contained in its interface.
- Java Collection framework also provides several special-purpose implementations for situations that require nonstandard performance, usage restrictions, or other unusual behavior.
General Purpose Implementaitons
Core Collection interfaces Hierarchy