In this article we will discuss how to add elements at a particular index or position in a LinkedList in Java.

add() member function of LinkedList always appends the element at the end of LinkedList. Now suppose we don’t want to add element at the end of Linked List instead of it we want to add element somewhere in middle of LinkedList,

To add the element at the middle of LinkedList we will use an overloaded version of add() function i.e.

It will insert the given element at the specified index (position) in this list.

Lets see how to do this,




In above example we inserted 2 elements in a LinkedList at 3rd and 1st position respectively.