E
- The type of element of this list valuepublic interface ImmutableListValue<E> extends ImmutableCollectionValue<E,List<E>,ImmutableListValue<E>,ListValue<E>>
ImmutableCollectionValue
that is backed by a List
.
All "with" and "Without" methods are returning new instances as every
instance is immutable.Modifier and Type | Method and Description |
---|---|
E |
get(int index)
Gets the desired element at the desired index.
|
int |
indexOf(E element)
Queries for the index of the provided element.
|
ImmutableListValue<E> |
set(int index,
E element)
Creates a new
ImmutableListValue with the desired element at
the desired index. |
ImmutableListValue<E> |
with(int index,
E value)
Creates a new
ImmutableListValue with the specified element
at the specified position in the list. |
ImmutableListValue<E> |
with(int index,
Iterable<E> values)
Creates a new
ImmutableListValue with the specified elements
in the order that they are iterated to the list at the specified index. |
ImmutableListValue<E> |
without(int index)
Creates a new
ImmutableListValue without the element at the
specified index. |
asMutable, contains, containsAll, getAll, isEmpty, size, transform, with, withAll, withElement, without, withoutAll, withoutAll
E get(int index)
index
- The index of the element to returnIndexOutOfBoundsException
- if the index is out of rangeImmutableListValue<E> with(int index, E value)
ImmutableListValue
with the specified element
at the specified position in the list. As well, the element at the
provided index is shifted to the right, increasing its and the elements
thereafter their indices by one.index
- The index to add the provided element atvalue
- The element to addImmutableListValue<E> with(int index, Iterable<E> values)
ImmutableListValue
with the specified elements
in the order that they are iterated to the list at the specified index.
The element at the provided index and elements thereafter are shifted to
the right, increasing their indices by one.index
- The index to add the elements atvalues
- The elements to addImmutableListValue<E> without(int index)
ImmutableListValue
without the element at the
specified index. Shifts any subsequent elements to the left, subtracts
one from their indices.index
- The index of the element to excludeImmutableListValue<E> set(int index, E element)
ImmutableListValue
with the desired element at
the desired index.index
- The index to replace the elementelement
- The element to include at the indexint indexOf(E element)
element
- The element to get the index from