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
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 © 2015. All rights reserved.