import "github.com/bruceesmith/stack"
Package stack defines goroutine-safe methods for manipulating a generic stack data structure via the standard operations IsEmpty, Peek, Pop, Push and Size.
Stack is a Go stack implementation using a linked list It is go-routine safe
type Stack[T any] struct {
// contains filtered or unexported fields
}
func New[T any]() *Stack[T]
New creates an empty Stack
func (s *Stack[T]) IsEmpty() bool
IsEmpty returns true if the stack has no elements
func (s *Stack[T]) Peek() (value T, ok bool)
Peek returns a copy of the top element off the stack
func (s *Stack[T]) Pop() (value T, ok bool)
Pop removes the top element and returns it
func (s *Stack[T]) Push(v T)
Push adds an element to the top of the stack
func (s *Stack[T]) Size() int
Size returns the number of elements on the stack
Generated by gomarkdoc