E - the type of element in the listpublic interface ConsList<E> extends List<E>
cons cells.
Implementations are generally simple, singly linked lists.| Modifier and Type | Method and Description |
|---|---|
default E |
car()
Returns the first of the list.
|
default ConsList<E> |
cdr()
Returns the rest of the list.
|
E |
first()
Returns the first element in the list.
|
ConsList<E> |
rest()
Returns the rest of the list, excluding the first element.
|
ConsList<E> |
subList(int fromIndex,
int toIndex) |
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArrayparallelStream, removeIf, streamE first()
nil) then an
exception is thrown.NoSuchElementException - if this list is emptyConsList<E> rest()
nil) then an exception is thrown.NoSuchElementException - if this list is emptydefault E car()
first().NoSuchElementException - if this list is emptydefault ConsList<E> cdr()
rest().NoSuchElementException - if this list is empty