Java : LinkedList

Posted in Java Collections By Raj On November 18, 2017


The LinkedList class extends AbstractSequentialList and implements the List, Deque, and Queue interfaces, the LinkedList follows double LinkedList concept to store values, the below things you need to consider before choosing LinkedList

  • if you are planning to add elements in between list elements then the LinkedList is faster than ArrayList
  • if you want to read elements values based upon index number then LinkedList is faster than ArrayList
  • The LinkedList allows duplicate values

The LinkedList follows Double LinkedList concept if you see the below diagram every node has a reference to previous and next node, the advantage with this if you add a new node in between something like node 45 to node 55, it will not shift all nodes like in ArrayList it will just update references of previous and next records


Example: Read LinkedList values 

Output :