Collection/Management

◷ Reading Time: 2 minutes

add

Adds an item to a collection.

 |add (item)

addRange

Adds all items to a collection.

 |addRange (item)

insert

Inserts an item into a collection on a specific index.

 |insert (item, index)

remove

Removes an item from a collection by its reference.

 |remove (item)

removeAt

Removes an item from a collection by its index.

 |removeAt (index)

length

Check count

count

Determines the length of a sequence of elements.

 |count (localName, predicate)
  • localName: Optional
  • predicate: Optional (must follow localName)
  • return: Number (Integer)

Example:

Sample: people |count ()
Result: 4

elementAt

Gets an element by index in a collection.

 |elementAt (index)

peekAt

Gets an element by index in a collection and removes the element from the collection.

 |peekAt (index)

shuffle

Shuffles a collection using Fisher Yates.

 |shuffle ()

Example:

Sample: questions |shuffle ()
Returns: shuffled list of questions
Updated on July 31, 2019

Was this article helpful?

Related Articles