After creating this blog post Collection Operation - Get , i thought it would be good to look at the other Collection Operations in some detail too.
As stated in the article above, the Collection Operation action allows you to interact with a Collection Variable. This can be useful in many situations.
Add
This method allows you to add to a value at a specific index within a collection
Original Collection - Audi; BMW; Volkswagen
Value to add - Mercedes
Index - 2
Resulting Collection - Audi; BMW; Mercedes, Volkswagen
Remove
This method allows you to remove a value from a specific index within a collection
Original Collection - Audi; BMW; Volkswagen
Value to Remove - BMW
Index - 1
Resulting Collection - Audi; Volkswagen
Count
This method allows you to count the number of items in a collection
Original Collection - Audi; BMW; Volkswagen
Result - 3
Get
This method allows you to get a value from a specific index within a collection
Original Collection - Audi; BMW; Volkswagen
Index - 1
Result - BMW
Exists
This method returns the index of a value within a collection if the value is in the collection, returns null if the value doesn't exist
Original Collection - Audi; BMW; Volkswagen
Value - Audi
Result - 0
Original Collection - Audi; BMW; Volkswagen
Value - Mercedes
Result -
Sort
This method sorts the items in a collection
Original Collection - Audi; BMW; Volkswagen
Order - Ascending
Result - Audi; BMW; Volkswagen
Order - Descending
Result - Volkswagen; BMW; Audi
Pop
This method returns the last value in a collection
Original Collection - Audi; BMW; Volkswagen
Result - Volkswagen
Resulting Collection - Audi; BMW
Join
This method joins all the values in a collection with a specified delimiter and stores in a variable (not a collection variable)
Original Collection - Audi; BMW; Volkswagen
Delimiter - ,
Result - Audi, BMW, Volkswagen
Clear
This method clears all items in a collection
Original Collection - Audi; BMW; Volkswagen
Result -
Remove Duplicates
This method allows you to remove duplicate items in a collection
Original Collection - Audi; BMW; BMW; Volkswagen
Resulting Collection - Audi; BMW; Volkswagen
Remove by Value
This method allows you to remove items from a collection if the value exists. If the value doesn't exist the original collection is returned
Original Collection - Audi; BMW; Volkswagen
Value - BMW
Resulting Collection - Audi; Volkswagen
Original Collection - Audi; BMW; Volkswagen
Value - Mercedes
Resulting Collection - Audi; BMW; Volkswagen
Have fun with collections!!!