private static class ImmutableSLList.NIL<S> extends ImmutableSLList<S>
Modifier and Type | Class and Description |
---|---|
private class |
ImmutableSLList.NIL.SLNilListIterator
iterates through the a none destructive NIL list
|
Modifier and Type | Field and Description |
---|---|
private Iterator<S> |
iterator |
(package private) static ImmutableList<?> |
NIL |
private static long |
serialVersionUID
serial id
|
Modifier | Constructor and Description |
---|---|
private |
NIL() |
Modifier and Type | Method and Description |
---|---|
ImmutableList<S> |
append(ImmutableList<S> list)
appends a whole list (non-destructive)
|
ImmutableList<S> |
append(S... array)
appends element at end (non-destructive) (O(n))
|
ImmutableList<S> |
append(S element)
appends element to the list (non-destructive)
|
boolean |
contains(S obj) |
boolean |
equals(Object o) |
int |
hashCode() |
S |
head() |
boolean |
isEmpty() |
Iterator<S> |
iterator() |
ImmutableList<S> |
prepend(ImmutableList<S> list)
prepends a whole list (non-destructive)
|
ImmutableList<S> |
prepend(S element)
prepends element to the list (non-destructive)
|
private Object |
readResolve()
the NIL list is a singleton.
|
ImmutableList<S> |
removeAll(S obj)
removes all occurrences of obj
|
ImmutableList<S> |
removeFirst(S obj)
removes first occurrence of obj
|
int |
size() |
ImmutableList<S> |
tail() |
String |
toString() |
append, nil, prepend, prepend, prepend, reverse, take, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
static final ImmutableList<?> NIL
private static final long serialVersionUID
private Object readResolve() throws ObjectStreamException
ObjectStreamException
public int size()
public ImmutableList<S> prepend(S element)
ImmutableList
element
- the head of the created listpublic ImmutableList<S> prepend(ImmutableList<S> list)
ImmutableList
list
- the list to be prependedpublic ImmutableList<S> append(S element)
ImmutableList
element
- to be added at the endpublic ImmutableList<S> append(ImmutableList<S> list)
ImmutableList
list
- the list to be appendedpublic ImmutableList<S> append(S... array)
ImmutableList
array
- the array to be appendedpublic boolean contains(S obj)
public boolean isEmpty()
public S head()
public ImmutableList<S> tail()
public ImmutableList<S> removeAll(S obj)
ImmutableList
public ImmutableList<S> removeFirst(S obj)
ImmutableList