Skip to content

darylnwk/stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

stack

-- import "github.com/darylnwk/stack"

Usage

type Stack

type Stack struct {
}

Stack defines a thread safe stack

func New

func New() *Stack

New initialises a new Stack

func (*Stack) Peek

func (s *Stack) Peek() interface{}

Peek returns the element at the top of the stack

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop returns the top element and nil if the stack is empty

func (*Stack) Push

func (s *Stack) Push(elements ...interface{})

Push adds elements to the stack

func (*Stack) Size

func (s *Stack) Size() int

Size returns the total number of elements in the stack

About

Go implementation of stack using slice

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages