Sequence represents list of elements, that may
be accessed with index. Some of sequences (such
as string and tuple) are immutable and mutating
operations always return copy of original sequence
modified.
Methods
Appends given element to this sequence.
| Parameters |
element -
Element to append
|
| Returns |
Modified sequence, original or copy |
Clears this sequence.
| Returns |
Modified sequence, original or copy |
Concatenates given elements to this sequence.
| Parameters |
element -
Element to concatenate
elements -
Elements of compatible sequence are concatenated
|
| Returns |
Modified sequence, original or copy |
Count the number of elements which equals to given element.
| Parameters |
element -
Element to count
|
| Returns |
Number of elements mathinc given element |
Crops (shortens) this sequence to contain only specified range.
| Parameters |
start -
Start of sub sequence
length -
Length of sub sequence
|
| Returns |
Cropped sequence, original or copy |
Remove given range from sequence.
| Parameters |
start -
Start of sub sequence to remove
length -
Length of sub sequence to remove
|
| Returns |
Modified sequence, original or copy |
Checks if sequence ends with given element or sequence
Fills sequence with given element.
| Parameters |
element -
Element to fill with, default is null.
start -
Start of sub sequence to fill
start -
Length of sub sequence to fill
|
| Returns |
Modified sequence, original or copy |
Returns first element from sequence, or undefined.
| Parameters |
index -
Index to sequence, from beginning
|
| Returns |
Element from sequence |
Fetches value from multi dimensional sequence. (i.e. sequence
containing nested sequences). If missing index is encountered
undefined is returned.
Returns new sequence of a same type as this, containing
all elements that matched given regular expression.
| Parameters |
pattern -
Regular expression to match with
|
| Returns |
New sequence containing selected elements |
Finds the first index of given needle.
| Parameters |
needle -
Element to search for
fromIndex -
Start index of search
|
| Returns |
Index of needle, -1 if it wasn't found. |
Inserts given element (or elements) to this sequence.
Some elements might be replaced if length > 0.
| Parameters |
start -
Insertion position
length -
Length of sub sequence to overwrite
element -
Element to insert
elements -
Elements of compatible sequence are inserted
|
| Returns |
Modified sequence, original or copy |
Joins the string represtation of elements of this sequence
together with given clue (default is de", ");
| Parameters |
clue -
Clue to join elements with
|
Returns last element from sequence, or undefined.
| Parameters |
index -
Index to sequence, starting from end
|
| Returns |
Element from sequence |
Finds the last index of given needle. Searching
occurs from end to beginning.
| Parameters |
needle -
Element to search for
fromIndex -
Start index of search
|
| Returns |
Index or needle, -1 if it wasn't found. |
Returns the length of this sequence.
Finds and returns minimum and maximum value from this sequence.
| Returns |
tuple containing (minElement, maxElement) |
object pop()
Pops last element out of this sequence
object pop(
int index)
Pops element at given index out of this sequence
| Parameters |
index -
Index of element
|
| Returns |
Removed element |
Adds given elements to end this sequence. Adding occurs
in the same order as in parameter list, i.e. last parameter will
be last in sequence.
| Returns |
Modified sequence, original or copy |
Repeats this sequence given times.
| Parameters |
count -
Number of times to repeat this sequence
|
| Returns |
New sequence containing this sequence count times |
Expands or contracts sequence to given length. If length
is greater than current size, null is used as
a fill.
| Returns |
Modified sequence, original or copy |
Reverse elements in given range.
| Parameters |
start -
Start index of sub sequence to reverse
length -
Length of sub sequence to reverse
|
| Returns |
Reversed sequence, original or copy |
Performs binary-search this sequence.
| Parameters |
comparator -
Comparator function:
function comparator(elem1, elem2).
return less than 0 if elem1elem2.
element -
Element to search for
|
| Returns |
Index of element found, or less than 0 if no element could be found. |
Sets value at given multi-dimensional sequence (i.e. sequence
containing nested sequences). If missing index is encountered
sequences remain unchanged.
| Parameters |
value -
Value to set
|
| Returns |
value |
Shifts (removes and returns) the first element out this sequence.
| Returns |
First element of sequence, or undefined
if sequence was empty. |
Takes slice from sequence.
| Parameters |
start -
Start of sub sequence
length -
Length of sub sequence
|
| Returns |
Sub sequence |
Sorts this sequence.
| Parameters |
start -
Start of sub sequence to sort
start -
Lenght of sub sequence to sort
comparator -
Comparator function
function comparator(elem1, elem2).
Function should
return less than 0 if elem1<elem2, 0 if elem1==elem2 or
more than 0 if elem1>elem2.
|
| Returns |
Sorted sequence, original or copy |
Checks if sequence starts with given element or sequence
Swaps elements of given indices.
| Returns |
Modified sequence, original or copy |
Insert given elements to this start sequence. Insertion
happens in the same order as they appear in parameter list,
i.e. last parameter will be first in sequence.
| Returns |
Modified sequence, original or copy |
Attributes
int this.length
Length of this sequence
References
object
this[
int index]
Returns element at given index
sequence
this[
int start..int end]
Returns sequence from given range
sequence
this[indices...]
Returns sequence of elements
object
this[
int index] = element
Sets the element at given index
object
this[
int start .. int end] = element
Sets the content of sub sequence
object
this[
int start .. int end] = sequence
Sets the content of sub sequence
| Parameters |
index -
Index of element
start -
Start of range (included)
end -
End of range (excluded)
element -
Element to set
sequence -
Elements to set
|
Operators
Length of this sequence
boolean (boolean)this
true if length of this sequence is greater than 0,
false otherwise.
this[] = element
Appends element to end of this sequence
this[] = sequence
Appends elements of sequence to end of this sequence
delete
this[
int index]
Removes element at given index
delete
this[
int start..int end]
Removes given range
delete
this[indices...]
Removes indicices and ranges
| Parameters |
index -
Index of element
start -
Start of range (included)
end -
End of range (excluded)
index -
Index of element
|
element in
this Checks if given element is in this sequence
sequence in
this Checks if given sequence is a sub sequence
in this sequence
iterator *this
Returns iterator of elements in this sequence