Skip to main content

Stack

Stack collection (LIFO discipline).

Minimal LIFO (last in first out) implementation, as a class. See library Deque for mixed LIFO/FIFO behavior.

Stack

class Stack<T>()

push

func push(x : T)

Push an element on the top of the stack.

isEmpty

func isEmpty() : Bool

True when the stack is empty.

peek

func peek() : ?T

Return and retain the top element, or return null.

pop

func pop() : ?T

Remove and return the top element, or return null.