Returns collection backed by this stack. Iterations will be in LIFO order. Time complexity is O(1).
collection of elements from this stack.
Returns true if this stack is empty.
true
if this stack is empty; false
otherwise
Returns (but does not remove) the item most recently added to this stack.
the element most recently added to this stack.
Removes and returns the item most recently added to this stack.
the element most recently added.
Adds the item to this stack.
the element to add
this stack
Returns the number of elements in the stack.
the number of elements in the stack
Returns a string representation of this stack.
the sequence of elements in the stack in LIFO order, separated by spaces
Generated using TypeDoc
The Stack class represents a last-in-first-out (LIFO) stack of generic items. It supports the usual
push and pop operations, along with methods for peeking at the top item. Also it extends
Collection API for iteration and testing whether the Stack is empty.