Bundle Typed tuple classes (Pair, Triple, Quad) for grouping related values without defining a class. Immutable by design; use as map keys or return values. Compile with -lib gen_collect.
Pair
Tuple class that supports 2 values
pair := Collection.Tuple.Pair->New("name", 42)<String, IntRef>;
pair->GetFirst()->PrintLine();
pair->GetSecond()->PrintLine();Operations
GetFirst #
Returns the first value
method : public : GetFirst() ~ AReturn
| Type | Description |
|---|---|
| A | first value |
Example
pair := Collection.Tuple.Pair->New("alpha", 1)<String, IntRef>;
pair->GetFirst()->PrintLine(); # alphaGetSecond #
Returns the second value
method : public : GetSecond() ~ BReturn
| Type | Description |
|---|---|
| B | second value |
Example
pair := Collection.Tuple.Pair->New("beta", 2)<String, IntRef>;
pair->GetSecond()->PrintLine(); # 2New # constructor
Constructor.
New(a:A, b:B)Parameters
| Name | Type | Description |
|---|---|---|
| a | A | first parameter |
| b | B | second parameter |
Example
pair := Collection.Tuple.Pair->New("hello", 42)<String, IntRef>;
pair->GetFirst()->PrintLine(); # hello
pair->GetSecond()->PrintLine(); # 42