Get LinkedList elements

We can use get() method for retrieving the element from LinkedList There are 3 different get() methods in LinkedList 1) Object get(int index); 2) Object getFirst(); 3) Object getLast(); Let’s discuss these methods with example Object get(int index) It returns the value present at the specified index This method throws IndexOutOfBoundsException if the index is […]

Share this article on

Remove LinkedList elements

We can use remove() method of LinkedList to delete/remove elements from LinkedList There are several methods to perform “remove” action in LinkedList 1) Object remove(); 2) Object remove(int index); 3) boolean remove(Object o); 4) Object removeFirst(); 5) boolean removeFirstOccurence(Object o); 6) Object removeLast(); 7) boolean removeLastOccurence(); Object remove() Removes the first element from the list […]

Share this article on
< Previous Next >