consider a situation in which you have to store heterogeneous data elements as a single entity. can you do it with an array? no. So, we need a new concept and that new concept is the collection.
As the name suggests, the collection is a group of individual objects.
If we want to represent a group of individual objects as a single entity then we should go for collection.
java provides collection framework which defines several classes and interfaces to represent a collection.
In c++, we have a similar concept of the container which provides standard template library (STL).
Now let’s have a look on the different java collection interfaces.