Collection:
Collection is an interface in Java used to store and manage a group of objects.
It is part of the Java Collection Framework.
Collections can automatically change their size by adding or removing elements.
It provides methods such as add(), remove(), and contains().
List, Set, and Queue are subinterfaces of Collection.
It helps in efficient storage and manipulation of data.
List:
List is an interface in the Java Collection Framework.
It stores elements in an ordered sequence.
It allows duplicate values.
Elements can be accessed using their index position.
Common implementations are ArrayList, LinkedList.
It is used when the order of elements is important.
Set:
Set is an interface in the Java Collection Framework.
It stores only unique elements.
Duplicate values are not allowed.
It is used when duplicate elements should be avoided.
Top comments (0)