API: IList
IList
is the interface for ordered sequences of elements, analogous to java.util.List
.
Key Methods
IList<V> addLast(V value)
Returns a new list with the specified value appended to the end.
IList<V> addFirst(V value)
Returns a new list with the specified value prepended to the beginning.
IList<V> removeLast()
Returns a new list with the last element removed. If the list is empty, it returns an identical list.
IList<V> removeFirst()
Returns a new list with the first element removed. If the list is empty, it returns an identical list.
IList<V> set(long idx, V value)
Returns a new list where the element at idx
is replaced with value
. If idx
is equal to the list's size, this is equivalent to addLast
.
V first()
Returns the first element in the list. Throws IndexOutOfBoundsException
if the list is empty.
V last()
Returns the last element in the list. Throws IndexOutOfBoundsException
if the list is empty.
IList<V> slice(long start, long end)
Returns a view of the portion of this list between the specified start
(inclusive) and end
(exclusive) indices.
IList<V> concat(IList<V> l)
Returns a new list representing the concatenation of this list and another list.
java.util.List<V> toList()
Returns a read-only java.util.List
wrapper around the IList
for interoperability.