stack

package
v0.5.35 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause Imports: 0 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 generic 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) onto the stack.

Jump to

Keyboard shortcuts

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