Collection Overview

Collection is a framework provided by java to store and manipulate a group of objects

There are various interfaces and classes are provided in collection framework

Collection_Overview

Collection_Overview_2

Collection

It is the root interface in the collection hierarchy

Collection is base interface which we may use in our code as a type for all collection subtypes

There are various methods declared in Collection interface which are common to all its subtypes

Collections

It’s a utility class provided by java for collection framework

This utility class provides useful operations for handling the collections

Arrays

This class is a utility class which contains several static methods that we can use to perform various operations such as
fill, sort, search, etc in arrays.

List

An ordered collection (also known as a sequence).

It is also an interface which is a subtype of Collection interface

The user of this interface has precise control over where in the list each element is inserted.

The user can access elements by their integer index (position in the list), and search for elements in the list.

List has 3 subclasses

1) ArrayList
2) Vector
3) LinkedList

Note :
List allows duplicate elements and it follows insertion order

Queue

It is also an interface which is a subtype of Collection interface

It follows a FIFO approach i.e. it orders the elements in First in First Out manner.

In a queue, the first element is removed first and last element is removed at the last.

Queue has below 2 subclasses

1) LinkedList
2) PriorityQueue

Note :
Queue allows duplicate elements and it follows FIFO order

Set

It is also an interface which is a subtype of Collection interface

It is used to store multiple objects without duplicates

Set has below 3 subclasses

1) HashSet
2) LinkedHashSet
3) TreeSet(which implements SortedSet interface)

Note :
Set doesn’t allow duplicate elements

Map

It is not a part of collection framework, it does not implement collection interface.

Map is mainly used to store key – value pair

It has below 4 subclasses

1) HashMap
2) LinkedHashMap
3) TreeMap(which implements SortedMap interface)
4) HashTable

Note :
All the above collection classes and interfaces are part of java.util package.

About the Author

Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on