Sublist

Syntax

	$set.subList($startIndex)

$set.subList($startIndex, $stopIndex)

Description

Returns a part of the given list specified by the indices.

Parameters

Name Type Description Mandatory Default
set set A list from which a partial list is to be taken. yes
startIndex Number The index of set where the sublist is to start (inclusive). The first element of set is 0. The element with the specified startIndex is included in the sublist. yes
stopIndex Number The index of set where the sublist should end (exclusive). The first element of set is 0. The element with the specified stopIndex is not included in the sublist. no The sublist contains all elements from startIndex to the end of list. Equivalent to $set.subList($startIndex, $set.size()).

Return value

Type: Set

A sublist of the specified set set.

Examples

Sublist without stopIndex

	list(1, 2, 3, 4, 5).subList(2)

Output: A set with the elements [3, 4, 5].

At index 2 is the number 3. From there all elements are included in the sublist.

Sublist with stopIndex

	list(1, 2, 3, 4, 5).subList(2, 4)

Output: A set with the elements [3, 4].

At index 2 is the number 3 and index 4 is the number 5. The stopIndex is not included in the sublist.