stack

package
v0.0.0-...-a2b96ca Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 1 Imported by: 1

Documentation

Overview

Package stack :: stack.go - stack implementations see https://gist.github.com/bemasher/1777766

Package stack :: str.go - a string stack

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

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

Element struct

type Stack

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

Stack struct

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

IsEmpty returns true if stack has no element

func (*Stack) Len

func (s *Stack) Len() int

Len returns the stack's length/size

func (*Stack) Peek

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

Peek returns the top of the stack without popping out the item

func (*Stack) Pop

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

Pop the top element from the stack and return it's value returns nil if the stack is empty

func (*Stack) Push

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

Push a new element on top of the stack

type Str

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

Str struct is a string stack implementation

func (*Str) IsEmpty

func (s *Str) IsEmpty() bool

IsEmpty returns true if stack has no element

func (*Str) Len

func (s *Str) Len() int

Len returns the stack's length/size

func (*Str) Peek

func (s *Str) Peek() string

Peek returns the top of the stack without popping out the item

func (*Str) Pop

func (s *Str) Pop() string

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

func (*Str) Push

func (s *Str) Push(value string)

Push a new element on top of the stack

func (Str) String

func (s Str) String() string

String func

Jump to

Keyboard shortcuts

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