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 java.util.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(java.lang.Object o) |
boolean |
exists(java.util.function.Predicate<S> predicate)
return true if predicate is fullfilled for at least one element
|
int |
hashCode() |
S |
head() |
boolean |
isEmpty() |
java.util.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)
|
ImmutableList<S> |
prependReverse(ImmutableList<S> list)
prepends an immutable list in reverse order, i.e.,
[4,5,6].prepend([1,2,3]) will be [3,2,1,4,5,6]
(more efficient than
ImmutableList.prepend(ImmutableList) ) |
private java.lang.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() |
java.lang.String |
toString() |
append, nil, prepend, prepend, prependReverse, reverse, take, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
stream
static final ImmutableList<?> NIL
private static final long serialVersionUID
private final transient java.util.Iterator<S> iterator
private java.lang.Object readResolve() throws java.io.ObjectStreamException
java.io.ObjectStreamException
public int size()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
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> prependReverse(ImmutableList<S> list)
ImmutableList
ImmutableList.prepend(ImmutableList)
)public 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 exists(java.util.function.Predicate<S> predicate)
predicate
- the predicatepublic boolean isEmpty()
public java.util.Iterator<S> iterator()
public S head()
public ImmutableList<S> tail()
public ImmutableList<S> removeAll(S obj)
ImmutableList
public ImmutableList<S> removeFirst(S obj)
ImmutableList
public java.lang.String toString()
toString
in class java.lang.Object