Add Last¶
Description¶
This operation adds new values to the very end of a list.
Method¶
Add One Value
Backendless.Hive(hiveName).ListStore(keyName).addLast(value);
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a list. String value. |
value |
Value to add to the list. Can be of any data type. |
Add Multiple Values
Backendless.Hive(hiveName).ListStore(keyName).addLast(values);
where:
Argument | Description |
---|---|
hiveName |
Name of a hive where the operation is performed. String value. |
keyName |
Key name identifying a list. String value. |
values |
An array of values to add to the list. Individual values can be of any data type. |
Return Value¶
The number of values in the list after the new values are saved.
Example¶
Add One Value
The example below adds the new value "Apple"
to the very end of the "fruits"
list.
Backendless.Hive("groceryStore").ListStore("fruits").addLast("Apple");
where:
Argument | Description |
---|---|
"groceryStore" |
Name of a hive where the operation is performed. |
"fruits" |
Key name identifying a list. |
Add Multiple Values
The example below adds the ""Apple""
and ""Orange""
values to the very end of the fruits
list.
List<Object> values = new ArrayList<>();
values.add("Apple");
values.add("Orange");
Backendless.Hive("groceryStore").ListStore("fruits").addLast(values);
where:
Argument | Description |
---|---|
"groceryStore" |
Name of a hive where the operation is performed. |
"fruits" |
Key name identifying a list. |
Codeless Reference
¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a list. |
items |
A list of new items to add to the list. |
position: last |
Instructs Hive to add the new values at the end of the list. |
Returns the number of values in the list after the new values are saved.
Consider the following List storage:
The example below adds "Apple"
and "Orange"
to the end of the "fruits"
list:
The list will look as shown below after the Codeless logic runs: