public interface ImmutableList<T> extends Iterable<T>, Serializable
Modifier and Type | Method and Description |
---|---|
ImmutableList<T> |
append(ImmutableList<T> list)
appends a whole list (non-destructive)
|
ImmutableList<T> |
append(Iterable<T> collection)
appends an iterable collection
|
ImmutableList<T> |
append(T... array)
appends element at end (non-destructive) (O(n))
|
ImmutableList<T> |
append(T element)
appends element to the list (non-destructive)
|
boolean |
contains(T obj) |
T |
head() |
boolean |
isEmpty() |
Iterator<T> |
iterator() |
ImmutableList<T> |
prepend(ImmutableList<T> list)
prepends a whole list (non-destructive)
|
ImmutableList<T> |
prepend(Iterable<T> collection)
prepends an iterable collection
|
ImmutableList<T> |
prepend(T... array)
prepends array (O(n))
|
ImmutableList<T> |
prepend(T element)
prepends element to the list (non-destructive)
|
ImmutableList<T> |
removeAll(T obj)
removes all occurrences of obj
|
ImmutableList<T> |
removeFirst(T obj)
removes first occurrence of obj
|
ImmutableList<T> |
reverse()
Reverses this list
|
int |
size() |
ImmutableList<T> |
tail() |
ImmutableList<T> |
take(int n) |
<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))
|
forEach, spliterator
ImmutableList<T> prepend(T element)
element
- the head of the created listImmutableList<T> prepend(ImmutableList<T> list)
list
- the list to be prependedImmutableList<T> prepend(Iterable<T> collection)
ImmutableList<T> prepend(T... array)
array
- the array of the elements to be prependedImmutableList<T> append(T element)
element
- to be added at the endImmutableList<T> append(ImmutableList<T> list)
list
- the list to be appendedImmutableList<T> append(Iterable<T> collection)
ImmutableList<T> append(T... array)
array
- the array to be appendedT head()
ImmutableList<T> tail()
ImmutableList<T> take(int n)
n
elementsImmutableList<T> reverse()
boolean contains(T obj)
int size()
boolean isEmpty()
ImmutableList<T> removeFirst(T obj)
ImmutableList<T> removeAll(T obj)
<S> S[] toArray(S[] array)
<S> S[] toArray(Class<S> type)