Stack
Growable stack of generics (LIFO)
stack := Collection.Stack->New()<IntRef>;
stack->Push(1);
stack->Push(2);
stack->Push(3);
stack->Pop()->PrintLine(); # prints 3
stack->Top()->PrintLine(); # prints 2
stack->Size()->PrintLine(); # prints 2Operations
IsEmpty
Checks to see if the stack is empty
method : public : IsEmpty() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if empty, false otherwise |
Pop
Pops values from the stack
method : public : native : Pop(n:Int) ~ HParameters
| Name | Type | Description |
|---|---|---|
| n | Int | number of items to pop |
Return
| Type | Description |
|---|---|
| H | popped valued, Nil if stack is empty |
Pop
Pops a value from the stack
method : public : Pop() ~ HReturn
| Type | Description |
|---|---|
| H | popped valued, Nil if stack is empty |
Push
Pushes a value onto the stack
method : public : Push(value:H) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| value | H | to push |
ToArray
Converts the stack into an object array
method : public : native : ToArray() ~ H[]Return
| Type | Description |
|---|---|
| H[] | object array |
ToString
Formats the collection into a string. If an element implements the 'Stringify' interface, it's 'ToString()' is called.
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation |