stack

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: BSD-3-Clause Imports: 0 Imported by: 3

Documentation

Overview

Package stack provides a generic stack implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack[T any] []T

Stack provides a basic stack using a slice

func (*Stack[T]) Peek

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

Peek returns the last element on the stack. Returns nil / zero value if stack is empty.

func (*Stack[T]) Pop

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

Pop pops the top item off the stack. Returns nil / zero value if stack is empty.

func (*Stack[T]) Push

func (st *Stack[T]) Push(it ...T)

Push pushes item(s) on the stack

Jump to

Keyboard shortcuts

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