List Clear
Summary
- Internal name:
ListClear - Category: Collections
- Purpose: Remove all elements from a list variable, resetting it to
[]. - 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 Clear task empties a list variable by replacing its content with []. It is semantically equivalent to calling Init List on an existing variable, but expresses a clearing intent rather than an initialization.
Use it to reuse the same list variable across multiple iterations of a loop without re-declaring it in the Start node.
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
None. The variable referenced by list_variable_input is reset to [].
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 ListClear]) --> ResolveList[🔄 Resolve list_variable_input]
ResolveList --> CheckList{Valid list?}
CheckList -->|No| E1[❌ RESOLVE-VAR-005]
CheckList -->|Yes| Store["💾 setVariableValue\nvar ← []"]
Store --> Success([✅ VoidResult])
E1 --> Error([❌ Exception])
style Start fill:#e3f2fd
style Success fill:#c8e6c9
style Error fill:#ffcdd2
style ResolveList fill:#fff9c4
style Store fill:#c8e6c9
style E1 fill:#ffcdd2
How it works:
- Resolve list: Fetches and parses the JSON array string from the execution context
- Clear: Stores an empty
ArrayList<String>serialized as[]back into the context - Result: Returns
VoidResult