stack

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinCap = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

func New

func New[T any](c int) *Stack[T]

func (*Stack[T]) Cap

func (s *Stack[T]) Cap() int

func (*Stack[T]) Drain

func (s *Stack[T]) Drain() []T

func (*Stack[T]) Index

func (s *Stack[T]) Index(fn func(T) bool) int

func (*Stack[T]) Iterate

func (s *Stack[T]) Iterate(fn func(T) bool)

func (*Stack[T]) IterateRange

func (s *Stack[T]) IterateRange(lo, hi int, fn func(T) bool)

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

func (*Stack[T]) PeekIndex

func (s *Stack[T]) PeekIndex(i int) T

func (*Stack[T]) Pop

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

func (*Stack[T]) Push

func (s *Stack[T]) Push(e T)

func (*Stack[T]) Reverse

func (s *Stack[T]) Reverse()

func (*Stack[T]) Size

func (s *Stack[T]) Size() int

func (*Stack[T]) String

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

type Stack2

type Stack2[T comparable] struct {
	Stack[T]
}

func New2

func New2[T comparable](c int) *Stack2[T]

func (*Stack2[T]) Contains

func (s *Stack2[T]) Contains(e T) bool

Jump to

Keyboard shortcuts

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