Collection Interface's in Java

Collection Interface's in Java

Written by - Prajval Bhale

mail: prajwalbhale007@gmail.com | GitHub: github.com/prajvalbhale

(all content are available on my github Profile in PDF or Doc Format)

The Collection interface is a member of the Java Collection Framework and part of the java.util package. and one of the root interfaces of the Collection Hierarchy. The Collection interface is not directly implemented by any class. it is implemented indirectly via its subinterfaces like set.

For Example, the Hash Set class implements the Set interface which is a subinterface of the Collection interface. If a collection implementation doesn’t implement a particular operation.

What is Collection Framework?

This is the combination of Classes and Interfaces which are used for Storing and Manipulating the Data Efficiently and Quickly.

What is Framework?

This nothing but structure by using we build our software or application’s quickly and very fast way. And also not need to starting entirely from scratch.

No alt text provided for this image

 What is Mean By Interface and Why we Need?

An Interface’s Specifies the behaviour of class by providing an abstract type. One of the core java Concept’s like polymorphism, abstraction, and multiple inheritance are supported through the Interface only. So we need Interface more in java.

Need’s of Use Interface in Java:

1.     For Abstraction.

2.     For Multiple Inheritance.

3.     For Loose-Coupling.

List of the Interfaces in Java Collection Framework with Syntax:

1.     Collection: This is primary interface of collection framework.

Syntax:

           Public interface Collection<E> extends Iterable<>

2.     List:

             I.           This extends the Collection Interface.

             II.           This is ordered collection of Object.

             III.           This contains Duplicate Values as well.

             IV.           This one also allows an Random Access.

Syntax:

           Public interface List<E> extends Collection<E>

 

3.     Set:

            I.           This Does not contains any Duplicate Values or element’s.

            II.           Set include only Inherited Method’s.

Syntax:

           Public interface Set<E> extends Collection<E>

 4.     Queue:

            I.           This defines the Queue Data Structure.

            II.           This one Stores the Element’s in FIFO order.

Note: FIFO mean’s First In First Out

Syntax:

           Public interface Queue<E> extends Collection<E>

 5.     Map:

            I.           Map is not implement the collection.

            II.           Map contains only Unique Key’s But also have Duplicates.

           III.           There are two Interfaces implement Map in Java.

1]. Map Interface 2]. SortedMap

Thank You we will Meet Again with more Interesting Topic's. :)

To view or add a comment, sign in

More articles by Prajval Bhale

Others also viewed

Explore content categories