Collection Framework :
It defines several Classes and Interfaces to represent group of objects as single entity. In this tutorial I want to give just high end overview of Java Collection Framework. Further tutorials in this sections explains more details about Collection Interfaces and Classes of collection Framework.
We divided Collection Framework into several sections to understand more clearly. They are :
- List Types
- Set Types
- Queue Types
- Map Types
- Utility Classes and Interfaces
Below image illustrates more about these parts.
1. List Types :
In this section you will find List types (Interfaces and Classes) of Collections.
What are List types ? –
- List types represents group of individual objects as single entity.
- Preserves the insertion order. (The order of elements while saving and and the order of elements while retrieving is same).
- Duplicate element insertion is possible.
2. Set Types:
In this section you will find Set types (Interfaces and Classes) of Collections.
What are Set types ? –
- Set types represents group of individual objects as single entity.
- Insertion order not preserved. (The order of elements while saving and and the order of elements while retrieving is not same).
- Duplicate element insertion is not possible.
3. Queue Types :
In this section you will find Queue types (Interfaces and Classes) of Collections.
What are Queue types ? –
- Queue types represents group of individual objects as single entity.
- A queue supports the insert and remove operations using a FIFO (First-In-First-Out) discipline.
- A queue is designed to have elements inserted at the end of the queue, and elements removed from the beginning of the queue.
- By convention, we name the queue insert operation enqueue and the remove operation dequeue.
4. Map Types :
In this section you will find Map types (Interfaces and Classes) of Collections.
What are Map types ? –
- Map types represents group of objects as single entity.
- Represent each element as key value pair, and that key value pair called Entry.
- Map is a group of Entries.
- For example, List types and Set types stores student names as elements. So each student name is one element in Set type or List type objects. But if want to store student roll number and student name in each element in List types and Set types it’s not possible. We have to use Map type, in a Map each element (here it’s called Entry) is a key value pair. So key as roll number and value as Student name we can give, then Map type represents group of key value pairs (Entries).
5. Cursors :
In this section you will find Cursors of Collections. Cursors are Interfaces.
What is Cursor in Collection Framework ? –
- A Cursor is used to retrieve collection elements one by one.
- For Example Iterator, it is used to retrieve elements from List types and Set types.
I will discuss about all Cursor Interfaces in further sections.
6. Utility Classes and Interfaces :
In this section you will find Utility classes and Interfaces of Collections.
Utility classes and Interfaces in Collection Framework –
- Collection Framework provides some utility classes and interfaces to Sort a Collection object, to Search over Collection elements, to change order of elements, to convert Collection types to Array types and Array types to Collection types.
I will discuss more about each Utility Class and Interface in Further tutorials.In this tutorial I have not introduced any of Class or Interface of Collection Framework. This tutorial is just High End overview of Collection Framework. Further tutorials explains the major Collection Classes and Interfaces in depth.