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.
Type = new arraylist<Type> { /* initial values */ };
Alternatively, a sequence may be specified that is used to copy elements from.
list<Type> = new arraylist<Type> (sequence);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.
list.get (index); indexed access
list[index];
set
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | int | Type |
list.set (index, value); indexed access
list[index] = value;
add
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | Type | Type |
list.add (value);addFirst
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | Type | Type |
list.addFirst (value);addLast
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | Type | Type |
list.addLast (value);insert
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | int | Type |
list.insert (index, value);remove
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | Type | Type |
list.remove (value);removeFirst
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | none | Type |
list.removeFirst;removeLast
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | none | Type |
list.removeLast;removeAt
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | int | Type |
list.removeAt (index);addAll
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | sequence< Type > | list< Type > |
list.addAll (seq);removeAll
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | sequence< Type > | list< Type > |
list.removeAll (seq);clear
Operand type | Parameter type | Result type |
|---|---|---|
list< Type > | none | void |
list.clear; 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.
list.reverse;