Java Core Collections Explained |Java Collections Framework
In this Post you will get details about Java’s Core Collection interfaces and more details about Java Core collections.
Collection is an Object which holds data items that form a natural group. Example:- Collection of Names, collection of letters in mail etc…
Java defines some Core Collections which we can use based on the requirement like type of data and many other factors like uniqueness, name-value pair, order and Time taken to do CURD operations.
In Java Collection is the top level interface. All the Collections interfaces (Except Map) extends this Top level Collection .
Below are the Collection interfaces which Extends To Top Level Collection interface
- Map (doesn’t extend Collection interface)
Set is a special Type of Collection Interface which stores Unique items. so When we have a requirement where we don’t want to store duplicate elements then Set can be used to store elements. For Example:- storing the IDs of users created in a website.
Below are the implementations of the Set Interface in Java
List is a Type of Collection Interface which can store Duplicate items. List is also known as Ordered Collections. Using List one can retrieve elements using Position of the element in the list
Below are the implementations of the List Interface in Java
Queue is a Collection for holding elements prior to processing. Queues provide additional insertion, removal, and inspection operations. Queue Typically follows element in FIFO order
Dequeue are similar to Queue, except they can be accessed from both ends. DeQueue are known as double-ended-queue.
Map Interface is a special kind of Collection which doen’t extend Collection interface like other Core Collections. Map Interface is used to store Key Value pairs unlike other collection interfaces. A map cannot contain duplicate keys
Below are the implementations of the Map Interface in Java
We will find More details about Collections and their implementations in Next Topics