public class LinkedList<T> extends AbstractList<T>
| Modifier and Type | Field and Description |
|---|---|
protected LinkedListNode<T> |
first |
protected LinkedListNode<T> |
last |
protected int |
size |
modCount| Constructor and Description |
|---|
LinkedList() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T item) |
LinkedListNode<T> |
append(T item) |
T |
get(int index) |
Iterator<T> |
iterator() |
int |
size()
TODO: Ideally the complexity of the size function should be O(1) instead O(n)
But this would mean, that certain functions (link / unlink) that are currently
part of LinkedListNode would have to go here instead.
|
add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streamprotected LinkedListNode<T> first
protected LinkedListNode<T> last
protected int size
public LinkedListNode<T> append(T item)
public boolean add(T item)
add in interface Collection<T>add in interface List<T>add in class AbstractList<T>public T get(int index)
public int size()
size in interface Collection<T>size in interface List<T>size in class AbstractCollection<T>Copyright © 2018. All rights reserved.