What is a collection in java
A collection is an object that groups one or more than one element into a single unit. Collection framework provides interfaces and classes to store, retrieve and manipulate the data.
A collection framework contains interfaces, implementations and classes
- interfaces -Interfaces allow collections to be manipulated independently of the details of their representation
- implementations– These are reusable data structures.
Benefit of using collection:-
- We can add any objects to the collection.
- We can remove any objects from the collection.
- We can identify an object or group of objects from the collection.
- We can iterate/loop through the entire collection using utility classes.
Followings are the some list of Collection classes in Java:
- List
- Set
- Map
For sorting of collection use following interfaces:
Lear more about Collections in Java
Top comments (0)