stack

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStackEmpty = fmt.Errorf("Stack error: stack is empty, no value to get")

ErrStackEmpty want using Top() or Pop() on a empty stack.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

Stack stack struct

func NewStack

func NewStack() *Stack

NewStack declare a stack

func (*Stack) Empty

func (s *Stack) Empty() bool

Empty return the stack is empty

func (*Stack) Len

func (s *Stack) Len() int

Len return the legnth of the stack

func (*Stack) Pop

func (s *Stack) Pop() (value interface{}, err error)

Pop a value from the stack

func (*Stack) Push

func (s *Stack) Push(value interface{})

Push a value to the stack

func (*Stack) Top

func (s *Stack) Top() (value interface{}, err error)

Top return the top value of the stack and do not pop it

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL