Question: What are the Methods of Java LinkedList?

Answer: Method: boolean add(E e)
Description: It is used to append the specified element to the end of a list.

Method: void add(int index, E element)
Description: It is used to insert the specified element at the specified position index in a list.

Method: boolean addAll(Collection<? extends E> c)
Description: It is used to append all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.

Method: boolean addAll(Collection<? extends E> c)
Description: It is used to append all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator.

Method: boolean addAll(int index, Collection<? extends E> c)
Description: It is used to append all the elements in the specified collection, starting at the specified position of the list.

Method: void addFirst(E e)
Description: It is used to insert the given element at the beginning of a list.

Method: void addLast(E e)
Description: It is used to append the given element to the end of a list.
 
Method: void clear()
Description: It is used to remove all the elements from a list.

Method: Object clone()
Description: It is used to return a shallow copy of an ArrayList.

Method: boolean contains(Object o)
Description: It is used to return true if a list contains a specified element.

Method: Iterator<E> descendingIterator()
Description: It is used to return an iterator over the elements in a deque in reverse sequential order.

Method: E element()
Description: It is used to retrieve the first element of a list.

Method: E get(int index)
Description: It is used to return the element at the specified position in a list.

Method: E getFirst()
Description: It is used to return the first element in a list.


Method: E getLast()
Description: It is used to return the last element in a list.

Method: int indexOf(Object o)
Description: It is used to return the index in a list of the first occurrence of the specified element, or -1 if the list does not contain any element.

Method: int lastIndexOf(Object o)
Description: It is used to return the index in a list of the last occurrence of the specified element, or -1 if the list does not contain any element.

Method: ListIterator<E> listIterator(int index)
Description: It is used to return a list-iterator of the elements in proper sequence, starting at the specified position in the list.

Method: boolean offer(E e)
Description: It adds the specified element as the last element of a list.

Method: boolean offerFirst(E e)
Description: It inserts the specified element at the front of a list.

Method: boolean offerLast(E e)
Description: It inserts the specified element at the end of a list.

Method: E peek()
Description: It retrieves the first element of a list

Method: E peekFirst()
Description: It retrieves the first element of a list or returns null if a list is empty.

Method: E peekLast()
Description: It retrieves the last element of a list or returns null if a list is empty.

Method: E poll()
Description: It retrieves and removes the first element of a list.

Method: E pollFirst()
Description: It retrieves and removes the first element of a list, or returns null if a list is empty.

Method: E pollLast()
Description: It retrieves and removes the last element of a list, or returns null if a list is empty.

Method: E pop()
Description: It pops an element from the stack represented by a list.

Method: void push(E e)
Description: It pushes an element onto the stack represented by a list.

Method: E remove()
Description: It is used to retrieve and removes the first element of a list.

Method: E remove(int index)
Description: It is used to remove the element at the specified position in a list.

Method: boolean remove(Object o)
Description: It is used to remove the first occurrence of the specified element in a list.

Method: E removeFirst()
Description: It removes and returns the first element from a list.

Method: boolean removeFirstOccurrence(Object o)
Description: It is used to remove the first occurrence of the specified element in a list (when traversing the list from head to tail).

Method: E removeLast()
Description: It removes and returns the last element from a list.

Method: boolean removeLastOccurrence(Object o)
Description: It removes the last occurrence of the specified element in a list (when traversing the list from head to tail).

Method: E set(int index, E element)
Description: It replaces the element at the specified position in a list with the specified element.

Method: Object[] toArray()
Description: It is used to return an array containing all the elements in a list in proper sequence (from first to the last element).

Method: <T> T[] toArray(T[] a)
Description: It returns an array containing all the elements in the proper sequence (from first to the last element); the runtime type of the returned array is that of the specified array.

Method: int size()
Description: It is used to return the number of elements in a list.