Stack

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StackHead string = " | →"
	StackSep  string = " | "
)

Functions

This section is empty.

Types

type ErrEmptyStack

type ErrEmptyStack struct{}

func (ErrEmptyStack) Error

func (e ErrEmptyStack) Error() string

type ErrFullStack

type ErrFullStack struct{}

func (ErrFullStack) Error

func (e ErrFullStack) Error() string

type Stack

type Stack[T any] struct {
	// contains filtered or unexported fields
}

func NewLimitedStack

func NewLimitedStack[T any](implementation StackImplementationType, capacity int, values ...T) Stack[T]

func NewStack

func NewStack[T any](implementation StackImplementationType, values ...T) Stack[T]

func (*Stack[T]) Clear

func (stack *Stack[T]) Clear()

func (Stack[T]) IsEmpty

func (stack Stack[T]) IsEmpty() bool

func (Stack[T]) IsFull

func (stack Stack[T]) IsFull() bool

func (Stack[T]) Peek

func (stack Stack[T]) Peek() T

func (*Stack[T]) Pop

func (stack *Stack[T]) Pop() T

func (*Stack[T]) Push

func (stack *Stack[T]) Push(value T)

func (Stack[T]) Size

func (stack Stack[T]) Size() int

func (*Stack[T]) String

func (stack *Stack[T]) String() string

func (*Stack[T]) ToSlice

func (stack *Stack[T]) ToSlice() []T

type StackImplementationType added in v0.2.1

type StackImplementationType int
const (
	LinkedStack StackImplementationType = iota
	ArrayStack
)

func (StackImplementationType) String added in v0.2.1

func (implementation StackImplementationType) String() string

Jump to

Keyboard shortcuts

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