What is collection
Collection is an API which is given by java to store multiple object in single unit this objects may be same type or different type.
Every collection classes in java is based on some data structure whether this data structure is Stack,LinkedList, Queue etc.
Collection is an interface and it is root interface of List and Set.
What is Collection Framework
Collection Framework define several classes and interfaces,which can be used to represent a group of object as single unit.
When to use Collection
If we want to represent group of individual objects as single entity then we should go for Collection.
Usually we can use collection to store and transfer objects over the network
In general Collection interface is considered as root interface of collection framework.
Collection interface defines the most common methods which can be applicable for any objects.
Advantage of Collection
Reduced development effort by using core collection classes rather than implementing our own collection classes.
Points to Remember
- every collection classes implements Serializable,Cloneable interface.
- In every collection implementation classes toString() is overridden to return its content directly.