List Size
Summary
- Internal name:
ListSize - Category: Collections
- Purpose: Get the number of elements in a list variable and store it in an output variable.
- Task type: Normal
Compatibility
-
Minimum AndroMate version:
1.1.0 -
Maximum AndroMate version:
1.1.0 -
Minimum Android:
Android 13 (API 33) -
Maximum Android tested:
Android 16 (API 36) -
Supported manufacturers:
- ✅ All manufacturers
-
Required permissions:
- None
Detailed description
The List Size task reads the number of elements in a list variable and stores the integer result in the variable specified by ops_output. The list itself is not modified.
Typical usage: retrieve the size, then use it as the upper bound in an Iterate task or compare it with Compare Number.
Input parameters
| Parameter | Type | Required | Possible values | Android Compatibility | AndroMate Compatibility | Default |
|---|---|---|---|---|---|---|
list_variable_input |
Variable reference | Yes | Declared variable starting with $, holding a valid list |
Android 13 (API 33) → Android 16 (API 36) | 1.1.0 → 1.1.0 | — |
Output parameters
| Field | Type | Condition | Default |
|---|---|---|---|
ops_output |
Integer | On success — number of elements in the list | 0 |
Exceptions
| Code | Exception Name | Description |
|---|---|---|
COLLECTION-TASK-002 |
List Variable Name Invalid | list_variable_input is empty or does not start with $. |
RESOLVE-VAR-005 |
Resolve ArrayList Error | The variable does not contain a valid JSON array string. |
Execution flowchart
flowchart TD
Start([Start ListSize]) --> ResolveList[🔄 Resolve list_variable_input]
ResolveList --> CheckList{Valid list?}
CheckList -->|No| E1[❌ RESOLVE-VAR-005]
CheckList -->|Yes| Size[size = list.size]
Size --> SetOutput[💾 result.setVariable size\nstored via ops_output]
SetOutput --> Success([✅ TaskIntegerResult])
E1 --> Error([❌ Exception])
style Start fill:#e3f2fd
style Success fill:#c8e6c9
style Error fill:#ffcdd2
style ResolveList fill:#fff9c4
style SetOutput fill:#c8e6c9
style E1 fill:#ffcdd2
How it works:
- Resolve list: Fetches and parses the JSON array string from the execution context
- Get size: Calls
list.size() - Store output: Writes the integer size into the variable specified by
ops_output - Result: Returns
TaskIntegerResult