We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

linkedlist

LinkedList is a kind of List used to store elements. Its an ordered collection i.e. elements added at a position in LinkedList will remain in that position till modified by user.

It internally uses a doubly linked list datastructure implementation i.e. each element is stored at separate node. Each node has a reference to previous and next node i.e

Advertisements

linkedlist

 

Advantage of LinkedList

Insertion and Deletion from the middle of LinkedList is very fast. Its just the matter of resetting 2 references.

Disadvantage of LinkedList:

LinkedList don’t provide effective random access of elements. It means if we want to access 5th element from LinkedList then we need to iterate through 1 to 5 elements to reach the 5th one. So, random access operations are very slow in LinkedList

Now, lets see how to create a LinkedList object in Java,

List<String> listOfStr = new LinkedList<>();

In Java, LinkedList implements List Interface, therefore we can keep the LinkedList object in List reference.

Now Lets see how we can use LinkedList through various examples,

Cart

Your Cart is Empty

Back To Shop