Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
func NewStackWithCap ¶
NewStack creates a new stack with passing `capacity` argument to `make(T[],...)`.
func (*Stack[T]) Pop ¶
func (s *Stack[T]) Pop() T
Pop pops the top element on the stack. The stack size needs to be greater > 0.
func (*Stack[T]) PopFront ¶
func (s *Stack[T]) PopFront() T
PopFront pops the bottom level on the stack. This method is useful to do Breath-First-Traversal. instead of Depth-First-Traversal when using `Pop`.
func (*Stack[T]) Visit ¶
Visit travers the stack from top to bottom and applies a function. If the visitor returns `false` the iteration is aborted.
func (*Stack[T]) VisitUpward ¶
Visit travers the stack from bottom to top and applies a function. If the visitor returns `false` the iteration is aborted.
Click to show internal directories.
Click to hide internal directories.