E - The type of the elements in the linked list.public final class LinkedList<E>
extends java.util.AbstractCollection<E>
implements java.util.List<E>, java.util.RandomAccess, java.lang.Cloneable
| Constructor and Description |
|---|
LinkedList()
This default constructor creates an empty instance of a linked list.
|
LinkedList(java.util.Collection<? extends E> elements)
This constructor creates an instance of a linked list that contains the elements from
the specified collection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element) |
void |
add(int index,
E newElement) |
boolean |
addAll(int index,
java.util.Collection<? extends E> collection) |
void |
clear() |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object object) |
E |
get(int index) |
int |
hashCode() |
int |
indexOf(java.lang.Object element) |
java.util.ListIterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object element) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
LinkedList<E> |
remove(int firstIndex,
int lastIndex)
This method removes the elements in the specified range [firstIndex..lastIndex) and shifts
the existing elements down to fill in the gap.
|
boolean |
remove(java.lang.Object object) |
E |
set(int index,
E element) |
int |
size() |
LinkedList<E> |
subList(int fromIndex,
int toIndex) |
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitpublic LinkedList()
public LinkedList(java.util.Collection<? extends E> elements)
elements - The elements that should be used to seed the list.public int size()
public int indexOf(java.lang.Object element)
indexOf in interface java.util.List<E>public int lastIndexOf(java.lang.Object element)
lastIndexOf in interface java.util.List<E>public boolean add(E element)
public boolean addAll(int index,
java.util.Collection<? extends E> collection)
addAll in interface java.util.List<E>public LinkedList<E> remove(int firstIndex, int lastIndex)
firstIndex - The index of the first element to be removed.lastIndex - The index of the last element after the range to be removed.public boolean remove(java.lang.Object object)
public void clear()
public java.util.ListIterator<E> iterator()
public java.util.ListIterator<E> listIterator()
listIterator in interface java.util.List<E>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E>public LinkedList<E> subList(int fromIndex, int toIndex)
subList in interface java.util.List<E>public boolean equals(java.lang.Object object)
public int hashCode()
public java.lang.Object clone()
clone in class java.lang.ObjectCopyright © 2015 Crater Dog Technologies(TM). All rights reserved.