StackType
protocol StackType
A protocol that describes an instance that can act as a stack data structure
-
pop()
Extension methodDefault implementation of popping the last element off the stack
Declaration
Swift
@discardableResult mutating func pop() -> StackItem?
-
push(_:)
Extension methodPush a new element on to the stack
Declaration
Swift
mutating func push(_ itemToPush: StackItem)
-
clear()
Extension methodClear all elements from the stack
Declaration
Swift
mutating func clear()
-
count
Extension methodReturns the number of elements on the stack
Declaration
Swift
var count: Int { get }
-
isEmpty
Extension methodCheck whether the stack is empty or not
Declaration
Swift
var isEmpty: Bool { get }
-
last
Extension methodReturn the last element on the stack without popping it off the stack. Equivalent to peek in other stack implementations
Declaration
Swift
var last: StackItem? { get }