List
A basic list container backed by either array list or linked list.
List type
list<Type>
Subtypes | Supertypes | Comparable types |
---|---|---|
none | sequence<Type> | java.util.List<Type> |
List creation
new arraylist
new linkedlist
Parameter type | Result type |
---|---|
Type... | list<Type> |
Creates an empty list. Optionally, initial values may be specified right in the new list creation expression.
Alternatively, a sequence may be specified that is used to copy elements from.
Operations on list
iterator
Operand type | Parameter type | Result type |
---|---|---|
sequence<Type> | none | modifying_iterator<Type> |
This operation is redefined for list to return a modifying_iterator
.
get
Operand type | Parameter type | Result type |
---|---|---|
list<Type> | int | Type |
Yields the element at index position.
- indexed access
ex];set
Sets the element at index position to the specified value. Yields the new value.Operand type
Parameter type
Result type
list<Type>
int
TypeType
(index, value); - indexed access
ex] = value;add
Adds an element to the list.Operand type
Parameter type
Result type
list<Type>
Type
Type
(value);addFirst
Adds an element to the list as the first element.Operand type
Parameter type
Result type
list<Type>
Type
Type
First (value);addLast
Adds an element to the list as the last element.Operand type
Parameter type
Result type
list<Type>
Type
Type
Last (value);insert
Inserts an element into the list at the position index.Operand type
Parameter type
Result type
list<Type>
int
TypeType
ert (index, value);remove
Removes an element from the list.Operand type
Parameter type
Result type
list<Type>
Type
Type
ove (value);removeFirst
Removes the first element from the list.Operand type
Parameter type
Result type
list<Type>
none
Type
oveFirst;removeLast
Removes the last element from the list.Operand type
Parameter type
Result type
list<Type>
none
Type
oveLast;removeAt
Removes an element from the list located at the position index.Operand type
Parameter type
Result type
list<Type>
int
Type
oveAt (index);addAll
Adds all elements in the parameter sequence to the list.Operand type
Parameter type
Result type
list<Type>
sequence<Type>
list<Type>
All (seq);removeAll
Removes all elements in the parameter sequence from the list.Operand type
Parameter type
Result type
list<Type>
sequence<Type>
list<Type>
oveAll (seq);clear
Clears all elements from the list.Operand type
Parameter type
Result type
list<Type>
none
void
ar;
reverse
Operand type | Parameter type | Result type |
---|---|---|
list<Type> | none | list<Type> |
Produces a list with all elements from the original list in the reversed order.