LinkedList class Methods in Java Part -II

java.util.LinkedList

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

Some methods of LinkedList class.

iterator()This method returns an iterator over the elements in this list.

lastIndexOf(Object)This method returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

listIterator()This method returns a list iterator over the elements in this list

listIterator(int)This method returns a list-iterator of the elements in this list starting at the specified position in the list.

offer(K)This method adds the specified element as the tail (last element) of this list.

offerFirst(K)This method inserts the specified element at the front of this list.

offerLast(K)This method inserts the specified element at the end of this list.

parallelStream()This method returns a possibly parallel Stream with this collection as its source.
peek()This method retrieves but does not remove, the head (first element) of this list.

peekFirst()This method retrieves, but does not remove, the first element of this list, or returns null if this list is empty.

peekLast()This method retrieves, but does not remove, the last element of this list, or returns null if this list is empty.

poll()This method retrieves and removes the head (first element) of this list.

pollFirst()This method retrieves and removes the first element of this list, or returns null if this list is empty.

pollLast()This method retrieves and removes the last element of this list, or returns null if this list is empty.

pop()This method pops an element from the stack represented by this list.

push(K e)This method pushes an element onto the stack represented by this list.

remove()This method retrieves and removes the head (first element) of this list.

remove(int)This method removes the element at the specified position in this list.

remove(Object)This method removes the first occurrence of the specified element from this list if it is present.

removeAll(Collection)This method removes all of this collection's elements that are also contained in the specified collection

Some more Methods of LinkedList Part -I


Some more Methods of LinkedList Part -III


No comments:

Post a Comment