Methods in LinkedList

boolean add(Object element) It adds an element to the end of the list. list.add("java"); list.add(“java”); Above line adds the string “java” to the end of the linked list. void add(int index, Object item) It adds an element at the given index of the list. list.add(2, "welcome"); list.add(2, “welcome”); This will add the string “welcome” at […]

Share this article on

LinkedList overview

LinkedList is a doubly-linked list implementation of the List and Deque interfaces Hence it provides linked list data structure Important features of LinkedList 1) LinkedList maintains the insertion order similar to ArrayList 2) LinkedList contains duplicate elements 3) It’s a non-synchronized class 4) Elements can be searched in forward and backward directions 5) Searching an […]

Share this article on
< Previous Next >