class Tuple
A tuple is a sequence of immutable objects.
Tuples are sequences, just like Arrays
. The only difference is that tuples can’t be changed.
As tuples can be used as a Map keys, the toString()
method calls toString of each element,
to try to get a unique string key.
Members
Array
elements
Immutable elements of Tuple object.
Number
length
Returns the number of the elements.
Constructor
Tuple
([arguments])Creates a new sequence of immutable objects with the parameters provided.
Methods
Tuple.fromArray
(Array
elements)
Creates a new instance of a tuple based on the Array
- Static
- This function is static
get
(Number
index)
Returns the value located at the index.
toJSON
()Returns the Array representation of the sequence.
toString
()Returns the string representation of the sequence surrounded by parenthesis, ie: (1, 2).
The returned value attempts to be a unique string representation of its values.
values
()Gets the elements as an array