Question: What are the methods of Java List?

Answer: Method: void add(int index, E element)
Description: It is used to insert the specified element at the specified position in a list.

Method: boolean add(E e)
Description: It is used to append the specified element at the end of 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 a list.

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 clear()
Description: It is used to remove all of the elements from this list.
 
Method: boolean equals(Object o)
Description: It is used to compare the specified object with the elements of a list.

Method: int hashcode()
Description: It is used to return the hash code value for a list.

Method: E get(int index)
Description: It is used to fetch the element from the particular position of the list.

Method: boolean isEmpty()
Description: It returns true if the list is empty, otherwise false.

Method: int lastIndexOf(Object o)
Description: It is used to return the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element.

Method: Object[] toArray()
Description: It is used to return an array containing all of the elements in this list in the correct order.

Method: <T> T[] toArray(T[] a)
Description: It is used to return an array containing all of the elements in this list in the correct order.

Method: boolean contains(Object o)
Description: It returns true if the list contains the specified element

Method: boolean containsAll(Collection<?> c)
Description: It returns true if the list contains all the specified element
 
Method: int indexOf(Object o)
Description: It is used to return the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.

Method: E remove(int index)
Description: It is used to remove the element present at the specified position in the list.

Method: boolean remove(Object o)
Description: It is used to remove the first occurrence of the specified element.

Method: boolean removeAll(Collection<?> c)
Description: It is used to remove all the elements from the list.

Method: void replaceAll(UnaryOperator<E> operator)
Description: It is used to replace all the elements from the list with the specified element. 

Method: void retainAll(Collection<?> c)
Description: It is used to retain all the elements in the list that are present in the specified collection.

Method: E set(int index, E element)
Description: It is used to replace the specified element in the list, present at the specified position.

Method: void sort(Comparator<? super E> c)
Description: It is used to sort the elements of the list on the basis of specified comparator.

Method: Spliterator<E> spliterator()
Description: It is used to create spliterator over the elements in a list.

Method: List<E> subList(int fromIndex, int toIndex)
Description: It is used to fetch all the elements lies within the given range.

Method: int size()
Description: It is used to return the number of elements present in the list.