util/list.ql
| Function | Description |
|---|---|
| native fun size() on list | Gets the size of the list. |
| fun isEmpty(lst) on list | Checks if the list is empty. |
| native fun add(item) on list | Adds an item to the list. |
| native fun add(index, item) on list | Adds an item to the list at the specified index. |
| native fun addAll(itemList) on list | Adds all items of the given list to the current list. |
| native fun remove(index) on list | Removes an item from the list at the given index. |
| native fun contains(item) on list | Checks if the given item is contained in the list. |
| native fun subList(fromIndex, toIndex) on list | Returns a portion of the current list from the specified starting index to the end of the list. |
| native fun indexOf(item) on list | Checks the index of the given item in the list. |
| native fun join(delimiter) on list | Joins the items of the list into a single string. |
| native fun sort() on list | Sorts a list of numbers or strings in-place. |
| native fun sortReverse() on list | Sorts a list of numbers or strings in-place, in reverse order. |
Adds an item to the list at the specified index.
index
|
The index to add the item at |
item
|
The item to add |
If the index is out of bounds
Adds all items of the given list to the current list.
itemList
|
The items to add |
Removes an item from the list at the given index.
index
|
The index of the item to remove |
The item that was removed
If the index is out of bounds
Checks if the given item is contained in the list.
index
|
The index of the item to remove |
If the specified item is in the list
Returns a portion of the current list from the specified starting index to the end of the list.
fromIndex
|
The inclusive starting index of the list |
toIndex
|
The exclusive ending index of the list |
The created sublist
Checks the index of the given item in the list.
item
|
The item to check the location of |
The index of the item, or -1 if it is not in the list
Joins the items of the list into a single string.
delimiter
|
The string to join the items with |
The joined string