Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStackUnderflow = errors.New("stack underflow")
ErrStackUnderflow is returned when attempting to Pop from an empty Stack.
Functions ¶
This section is empty.
Types ¶
type Stack ¶
type Stack[T comparable] struct { sync.Mutex // contains filtered or unexported fields }
Stack is an abstract data type that serves as a collection of elements.
func NewStack ¶
func NewStack[T comparable]() Stack[T]
NewStack creates and returns an initialized stack.
func (*Stack[T]) Peek ¶
func (s *Stack[T]) Peek() T
Peek returns the top element on the Stack, without removing it.
If the Stack is empty, nil is returned.
Click to show internal directories.
Click to hide internal directories.