On this page
$list is a list tool used to work with lists and arrays in a template. It provides a method to get and manage specified elements. You can also use it as a means to perform some actions on a list or array such as:
- Check if it is empty.
 - Check if it contains certain elements.
 
For example:
| $primes $list.size($primes) $list.get($primes, 2) $list.set($primes, 2, 1) $list.get($primes, 2)For example: $list.isEmpty($primes) $list.contains($primes, 7)  | -> new int[] {2, 3, 5, 7}  | 
$list.contains(list, element)
Check if a list or array contains certain elements.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | list | - | A list or array  instance.  | 
| element | - | An element  instance.  | |
| Return | - | boolean | Return true if a  list or array contains certain elements. Otherwise, return false.  | 
$list.get(list, index)
Return a specified element of a list or array.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | list | - |  A list or array  instance.  | 
| index | - | An index of an  object in a list.  | |
| Return | - | object | Return an object  in a list.  | 
$list.isArray(object)
Check if an object is an array.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | object | - | An object | 
| Return | - | boolean | Return true if  the object is an array. Otherwise, returns false.  | 
$list.isEmpty(list)
Check if a list or array is empty.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | list | - | A list of  objects  | 
| Return | - | boolean | Return true if  the list or array is empty. Otherwise, returns false.  | 
$list.isList(object)
Check if an object is a list.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | object | - | An object | 
| Return | - | boolean | Return true,  if the object is a List. Otherwise, return false.  | 
$list.set(list, index, value)
Set a specified element of a List/array.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | list | - |  A list of  objects.  | 
| index | - | An index of  an object in the list.  | |
| value | - | An object to be  set to the list.  | |
| Return | - | object | An object at the  previously-specified position with the set value.  | 
$list.size(list)
Return the size of a List or array.
| Name | Type | Description | |
|---|---|---|---|
| Parameter(s) | list | - | A list of  objects.  | 
| Return | - | Integer | Return the size  of the list as an Integer.  |