Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 698 Bytes

README.md

File metadata and controls

50 lines (35 loc) · 698 Bytes

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