public interface ImmutableList<T>
extends java.lang.Iterable<T>, java.io.Serializable
Modifier and Type | Method and Description |
---|---|
ImmutableList<T> |
append(ImmutableList<T> list)
appends a whole list (non-destructive)
|
ImmutableList<T> |
append(java.lang.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) |
boolean |
exists(java.util.function.Predicate<T> predicate)
return true if predicate is fullfilled for at least one element
|
T |
head() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
ImmutableList<T> |
prepend(ImmutableList<T> list)
prepends a whole list (non-destructive)
|
ImmutableList<T> |
prepend(T... array)
prepends array (O(n))
|
ImmutableList<T> |
prepend(T element)
prepends element to the list (non-destructive)
|
ImmutableList<T> |
prependReverse(ImmutableList<T> collection)
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
prepend(ImmutableList) ) |
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> |
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() |
default java.util.stream.Stream<T> |
stream()
A stream object for this collection.
|
ImmutableList<T> |
tail() |
ImmutableList<T> |
take(int n) |
<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))
|
ImmutableList<T> prepend(T element)
element
- the head of the created listImmutableList<T> prepend(ImmutableList<T> list)
list
- the list to be prependedImmutableList<T> prependReverse(ImmutableList<T> collection)
prepend(ImmutableList)
)ImmutableList<T> prependReverse(java.lang.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(java.lang.Iterable<T> collection)
ImmutableList<T> append(T... array)
array
- the array to be appendedT head()
boolean exists(java.util.function.Predicate<T> predicate)
predicate
- the predicateImmutableList<T> tail()
ImmutableList<T> take(int n)
n
elementsImmutableList<T> reverse()
java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
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(java.lang.Class<S> type)
default java.util.stream.Stream<T> stream()