LinkedList class Methods in Java Part -III

java.util.LinkedList

Doubly-linked list implementation of the List and Deque interfaces.

Some methods of LinkedList class.

removeFirst()This method removes and returns the first element from this list.

removeFirstOccurrence(Object)This method removes the first occurrence of the specified element in this list.

removeIf(Predicate)This method removes all of the elements of this collection that satisfy the given predicate.

removeLast()This method removes and returns the last element from this list.

removeLastOccurrence(Object)This method removes the last occurrence of the specified element in this list.

replaceAll(UnaryOperator)This method replaces each element of this list with the result of applying the operator to that element.

retainAll(Collection)This method retains only the elements in this collection that are contained in the specified collection.

set(int, K)This method replaces the element at the specified position in this list with the specified element.


size()This method returns the number of elements in this list.


sort(Comparator)This method sorts this list according to the order induced by the specified Comparator.


spliterator()This method creates a late-binding and fail-fast Spliterator over the elements in this list.


stream()This method returns a sequential Stream with this collection as its source.


subList(int, int)This method returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

toArray()This method returns an array containing all of the elements in this list in proper sequence (from the first to the last element).

toArray(IntFunction)This method returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

toArray(K[])This method returns an array containing all of the elements in this list in proper sequence (from first to the last element); the runtime type of the returned array is that of the specified array.

toString()This method returns a string representation of this collection.

Some more Methods of LinkedList Part -I

Some more Methods of LinkedList Part -II

 

No comments:

Post a Comment