public abstract class ImmutableSLList<T> extends java.lang.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(java.lang.Iterable<T> collection)
appends an iterable collection
|
static <T> ImmutableSLList<T> |
nil()
the empty list
|
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> |
prependReverse(java.lang.Iterable<T> collection)
prepends an iterable collection in reverse order, i.e.,
[4,5,6].prepend([1,2,3]) will be [3,2,1,4,5,6]
|
ImmutableList<T> |
reverse()
Reverses this list (O(N))
|
ImmutableList<T> |
take(int n)
first
n elements of the list are truncated |
<S> S[] |
toArray(java.lang.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, waitprivate 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(java.lang.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(java.lang.Iterable<T> collection)
ImmutableListappend in interface ImmutableList<T>public ImmutableList<T> prependReverse(java.lang.Iterable<T> collection)
ImmutableListprependReverse 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