public abstract class ImmutableSLList<T> extends Object implements ImmutableList<T>
| Modifier and Type | Class and Description |
|---|---|
private static class |
ImmutableSLList.Cons<S> |
private static class |
ImmutableSLList.NIL<S> |
private static class |
ImmutableSLList.SLListIterator<T>
iterates through a none destructive list
|
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID
generated serial id
|
| Constructor and Description |
|---|
ImmutableSLList() |
| Modifier and Type | Method and Description |
|---|---|
ImmutableList<T> |
append(Iterable<T> collection)
appends an iterable collection
|
static <T> ImmutableSLList<T> |
nil()
the empty list
|
ImmutableList<T> |
prepend(Iterable<T> collection)
prepends an iterable collection
|
ImmutableList<T> |
prepend(T... array)
prepends array (O(n))
|
protected ImmutableList<T> |
prepend(T[] array,
int n)
prepends the first
n elements of an array (O(n)) |
ImmutableList<T> |
reverse()
Reverses this list (O(N))
|
ImmutableList<T> |
take(int n)
first
n elements of the list are truncated |
<S> S[] |
toArray(Class<S> type)
Convert the list to a Java array (O(n))
|
<S> S[] |
toArray(S[] array)
Convert the list to a Java array (O(n))
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappend, append, append, contains, head, isEmpty, iterator, prepend, prepend, removeAll, removeFirst, size, tailforEach, spliteratorprivate static final long serialVersionUID
public static <T> ImmutableSLList<T> nil()
public ImmutableList<T> reverse()
reverse in interface ImmutableList<T>public <S> S[] toArray(S[] array)
toArray in interface ImmutableList<T>public <S> S[] toArray(Class<S> type)
toArray in interface ImmutableList<T>public ImmutableList<T> prepend(T... array)
prepend in interface ImmutableList<T>array - the array of the elements to be prependedprotected ImmutableList<T> prepend(T[] array, int n)
n elements of an array (O(n))array - the array of the elements to be prependedn - an int specifying the number of elements to be prependedpublic ImmutableList<T> append(Iterable<T> collection)
ImmutableListappend in interface ImmutableList<T>public ImmutableList<T> prepend(Iterable<T> collection)
ImmutableListprepend in interface ImmutableList<T>public ImmutableList<T> take(int n)
n elements of the list are truncatedtake in interface ImmutableList<T>n - an int specifying the number of elements to be truncatedn elements