public class SingleLinkedList<T> extends AbstractList<T>
Modifier and Type | Field and Description |
---|---|
T |
head |
SingleLinkedList<T> |
tail |
modCount
Constructor and Description |
---|
SingleLinkedList(T head,
SingleLinkedList<T> tail) |
Modifier and Type | Method and Description |
---|---|
static <T> SingleLinkedList<T> |
empty() |
T |
get(int index) |
SingleLinkedList<T> |
grow(T item)
Creates a new list by adding a new element as the head.
|
boolean |
isEmpty() |
Iterator<T> |
iterator() |
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public final T head
public final SingleLinkedList<T> tail
public SingleLinkedList(T head, SingleLinkedList<T> tail)
public SingleLinkedList<T> grow(T item)
public T get(int index)
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface List<T>
isEmpty
in class AbstractCollection<T>
public static <T> SingleLinkedList<T> empty()
Copyright © 2016. All rights reserved.