Advantages and Disadvantages of the Java Collection Framework

A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes. It is used to store, retrieve, manipulate, and communicate aggregate data. Typically, it represents data items that form a natural group and allows duplicate elements while others do not. It consists of both ordered and unordered elements. 

The primary advantages of a collections framework are that it:

Reduces programming effort by providing useful data structures and algorithms so you don't have to write them yourself.
Increases performance by providing high-performance implementations of useful data structures and algorithms. Because the various implementations of each interface are interchangeable, programs can be easily tuned by switching implementations.
Provides interoperability between unrelated APIs by establishing a common language to pass collections back and forth.
Reduces the effort required to learn APIs by eliminating the need to learn multiple ad hoc collection APIs.
Reduces the effort required to design and implement APIs by eliminating the need to produce ad hoc collections APIs.
Fosters software reuse by providing a standard interface for collections and algorithms to manipulate them.

Disadvantages of collections framework:

It must cast to correct type.
It can't be done compile-time type checking.

1 comment:

Please Provide your feedback here