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 }
Stack is a generic thread-safe stack data structure.
func (*Stack[T]) Peek ¶
Peek returns the top element without removing it. Returns the zero value and false if the stack is empty.
func (*Stack[T]) PeekNthElement ¶ added in v1.17.0
PeekNthElement returns the element at position n from the top without removing it. n=0 returns the top element, n=1 returns the second element from top, etc. Returns the zero value and false if the index is out of bounds.
func (*Stack[T]) Pop ¶
Pop removes and returns the top element of the stack. Returns the zero value and false if the stack is empty.
Click to show internal directories.
Click to hide internal directories.