An implementation of the stack abstract data type. A stack is a collection of elements which operates in "LIFO" (last in, first out) order; that is, the element most recently added to the stack is the first one retrieved.
- Source Code:
- View Source
Instance Method Summary
- Pushes a new element onto the stack.
- Pops the top value from the stack and returns it.
- Inserts a new element at the specified depth.
-- index operator --
- Returns the value at the given depth in the stack.
- Removes all elements from the stack.
The number of elements on the stack.
@pre(count > 0)
method pop ():
Pops the top value from the stack and returns it.
Returns the value at the given depth in the stack. The top element (most recently pushed) is
element 0, and the bottom element (earliest pushed) is element
count - 1.
- value of type
method clear ()
Removes all elements from the stack.