Type Parameters:
E - the type of elements held in this collection
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E>, SequencedCollection<E>

  • Field Summary

    Fields declared in class AbstractList

    modCount

    protected int

    The number of times this list has been structurally modified.

  • Constructor Summary

    Constructors

    Constructs an empty list.

    Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.

  • Method Summary

    void

    add(int index, E element)

    Inserts the specified element at the specified position in this list.

    boolean

    add(E e)

    Appends the specified element to the end of this list.

    boolean

    Inserts all of the elements in the specified collection into this list, starting at the specified position.

    boolean

    Appends 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.

    void

    addFirst(E e)

    Inserts the specified element at the beginning of this list.

    void

    addLast(E e)

    Appends the specified element to the end of this list.

    void

    clear()

    Removes all of the elements from this list.

    clone()

    Returns a shallow copy of this LinkedList.

    boolean

    Returns true if this list contains the specified element.

    Returns an iterator over the elements in this deque in reverse sequential order.

    element()

    Retrieves, but does not remove, the head (first element) of this list.

    get(int index)

    Returns the element at the specified position in this list.

    getFirst()

    Returns the first element in this list.

    getLast()

    Returns the last element in this list.

    int

    Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

    int

    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(int index)

    Returns a list-iterator of the elements in this list (in proper sequence), starting at the specified position in the list.

    boolean

    offer(E e)

    Adds the specified element as the tail (last element) of this list.

    boolean

    offerFirst(E e)

    Inserts the specified element at the front of this list.

    boolean

    offerLast(E e)

    Inserts the specified element at the end of this list.

    peek()

    Retrieves, but does not remove, the head (first element) of this list.

    peekFirst()

    Retrieves, but does not remove, the first element of this list, or returns null if this list is empty.

    peekLast()

    Retrieves, but does not remove, the last element of this list, or returns null if this list is empty.

    poll()

    Retrieves and removes the head (first element) of this list.

    pollFirst()

    Retrieves and removes the first element of this list, or returns null if this list is empty.

    pollLast()

    Retrieves and removes the last element of this list, or returns null if this list is empty.

    pop()

    Pops an element from the stack represented by this list.

    void

    push(E e)

    Pushes an element onto the stack represented by this list.

    remove()

    Retrieves and removes the head (first element) of this list.

    remove(int index)

    Removes the element at the specified position in this list.

    boolean

    Removes the first occurrence of the specified element from this list, if it is present.

    Removes and returns the first element from this list.

    boolean

    Removes the first occurrence of the specified element in this list (when traversing the list from head to tail).

    Removes and returns the last element from this list.

    boolean

    Removes the last occurrence of the specified element in this list (when traversing the list from head to tail).

    reversed()

    Returns a reverse-ordered view of this collection.

    set(int index, E element)

    Replaces the element at the specified position in this list with the specified element.

    int

    size()

    Returns the number of elements in this list.

    toArray()

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

    <T> T[]

    toArray(T[] a)

    Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

    Methods declared in class AbstractList

    equals, hashCode, listIterator, removeRange, subList

    boolean

    Compares the specified object with this list for equality.

    int

    Returns the hash code value for this list.

    Returns a list iterator over the elements in this list (in proper sequence).

    protected void

    Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.

    subList(int fromIndex, int toIndex)

    Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

    Methods declared in class AbstractCollection

    containsAll, isEmpty, removeAll, retainAll, toString

    boolean

    Returns true if this collection contains all of the elements in the specified collection.

    boolean

    Returns true if this collection contains no elements.

    boolean

    Removes all of this collection's elements that are also contained in the specified collection (optional operation).

    boolean

    Retains only the elements in this collection that are contained in the specified collection (optional operation).

    Returns a string representation of this collection.

    Methods declared in class Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(long timeoutMillis)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    final void

    wait(long timeoutMillis, int nanos)

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

    Methods declared in interface Collection

    parallelStream, removeIf, stream, toArray

    Returns a possibly parallel Stream with this collection as its source.

    default boolean

    Removes all of the elements of this collection that satisfy the given predicate (optional operation).

    Returns a sequential Stream with this collection as its source.

    default <T> T[]

    Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array.

    Methods declared in interface Deque

    iterator

    Returns an iterator over the elements in this deque in proper sequence.

    Methods declared in interface Iterable

    forEach

    default void

    Performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.

    Methods declared in interface List

    containsAll, isEmpty, removeAll, replaceAll, retainAll, sort

    boolean

    Returns true if this list contains all of the elements of the specified collection.

    boolean

    Returns true if this list contains no elements.

    boolean

    Removes from this list all of its elements that are contained in the specified collection (optional operation).

    default void

    Replaces each element of this list with the result of applying the operator to that element (optional operation).

    boolean

    Retains only the elements in this list that are contained in the specified collection (optional operation).

    default void

    Sorts this list according to the order induced by the specified Comparator (optional operation).

  • Constructor Details

    • LinkedList

    • LinkedList

  • Method Details

    • getFirst

    • getLast

    • removeFirst

    • removeLast

    • addFirst

    • addLast

    • contains

    • size

    • add

    • remove

    • addAll

    • addAll

    • clear

    • get

    • set

    • add

    • remove

    • indexOf

    • lastIndexOf

    • peek

    • element

    • poll

    • remove

    • offer

    • offerFirst

    • offerLast

    • peekFirst

    • peekLast

    • pollFirst

    • pollLast

    • push

    • pop

    • removeFirstOccurrence

    • removeLastOccurrence

    • listIterator

    • descendingIterator

    • clone

    • toArray

    • toArray

    • spliterator

    • reversed