LinkedList (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

boolean

[add](../../java/util/LinkedList.html#add-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Appends the specified element to the end of this list.

void

[add](../../java/util/LinkedList.html#add-int-E-)(int index,[E](../../java/util/LinkedList.html "type parameter in LinkedList") element)

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

boolean

[addAll](../../java/util/LinkedList.html#addAll-java.util.Collection-)([Collection](../../java/util/Collection.html "interface in java.util")<? extends [E](../../java/util/LinkedList.html "type parameter in LinkedList")> c)

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.

boolean

[addAll](../../java/util/LinkedList.html#addAll-int-java.util.Collection-)(int index,[Collection](../../java/util/Collection.html "interface in java.util")<? extends [E](../../java/util/LinkedList.html "type parameter in LinkedList")> c)

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

void

[addFirst](../../java/util/LinkedList.html#addFirst-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Inserts the specified element at the beginning of this list.

void

[addLast](../../java/util/LinkedList.html#addLast-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Appends the specified element to the end of this list.

void

[clear](../../java/util/LinkedList.html#clear--)()

Removes all of the elements from this list.

[Object](../../java/lang/Object.html "class in java.lang")

[clone](../../java/util/LinkedList.html#clone--)()

Returns a shallow copy of this LinkedList.

boolean

[contains](../../java/util/LinkedList.html#contains-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

Returns true if this list contains the specified element.

[Iterator](../../java/util/Iterator.html "interface in java.util")<[E](../../java/util/LinkedList.html "type parameter in LinkedList")>

[descendingIterator](../../java/util/LinkedList.html#descendingIterator--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[element](../../java/util/LinkedList.html#element--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[get](../../java/util/LinkedList.html#get-int-)(int index)

Returns the element at the specified position in this list.

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[getFirst](../../java/util/LinkedList.html#getFirst--)()

Returns the first element in this list.

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[getLast](../../java/util/LinkedList.html#getLast--)()

Returns the last element in this list.

int

[indexOf](../../java/util/LinkedList.html#indexOf-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

[lastIndexOf](../../java/util/LinkedList.html#lastIndexOf-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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](../../java/util/ListIterator.html "interface in java.util")<[E](../../java/util/LinkedList.html "type parameter in LinkedList")>

[listIterator](../../java/util/LinkedList.html#listIterator-int-)(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](../../java/util/LinkedList.html#offer-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

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

boolean

[offerFirst](../../java/util/LinkedList.html#offerFirst-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Inserts the specified element at the front of this list.

boolean

[offerLast](../../java/util/LinkedList.html#offerLast-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Inserts the specified element at the end of this list.

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[peek](../../java/util/LinkedList.html#peek--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[peekFirst](../../java/util/LinkedList.html#peekFirst--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[peekLast](../../java/util/LinkedList.html#peekLast--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[poll](../../java/util/LinkedList.html#poll--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[pollFirst](../../java/util/LinkedList.html#pollFirst--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[pollLast](../../java/util/LinkedList.html#pollLast--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[pop](../../java/util/LinkedList.html#pop--)()

Pops an element from the stack represented by this list.

void

[push](../../java/util/LinkedList.html#push-E-)([E](../../java/util/LinkedList.html "type parameter in LinkedList") e)

Pushes an element onto the stack represented by this list.

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[remove](../../java/util/LinkedList.html#remove--)()

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[remove](../../java/util/LinkedList.html#remove-int-)(int index)

Removes the element at the specified position in this list.

boolean

[remove](../../java/util/LinkedList.html#remove-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[removeFirst](../../java/util/LinkedList.html#removeFirst--)()

Removes and returns the first element from this list.

boolean

[removeFirstOccurrence](../../java/util/LinkedList.html#removeFirstOccurrence-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[removeLast](../../java/util/LinkedList.html#removeLast--)()

Removes and returns the last element from this list.

boolean

[removeLastOccurrence](../../java/util/LinkedList.html#removeLastOccurrence-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") o)

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

[E](../../java/util/LinkedList.html "type parameter in LinkedList")

[set](../../java/util/LinkedList.html#set-int-E-)(int index,[E](../../java/util/LinkedList.html "type parameter in LinkedList") element)

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

int

[size](../../java/util/LinkedList.html#size--)()

Returns the number of elements in this list.

[Spliterator](../../java/util/Spliterator.html "interface in java.util")<[E](../../java/util/LinkedList.html "type parameter in LinkedList")>

[spliterator](../../java/util/LinkedList.html#spliterator--)()

[Object](../../java/lang/Object.html "class in java.lang")[]

[toArray](../../java/util/LinkedList.html#toArray--)()

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

<T> T[]

[toArray](../../java/util/LinkedList.html#toArray-T:A-)(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.