stack

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack[T any] interface {
	// Push adds an item to the top of the stack.
	Push(item T)

	// Pop removes and returns the item from the top of the stack.
	// Returns false if the stack is empty.
	Pop() (T, bool)

	// Peek returns the item at the top of the stack without removing it.
	// Returns false if the stack is empty.
	Peek() (T, bool)

	// Len returns the number of items currently in the stack.
	Len() int

	// IsEmpty checks if the stack is empty.
	IsEmpty() bool

	// Clear removes all items from the stack, leaving it empty.
	Clear()
}

Stack is an interface representing a LIFO (last-in, first-out) stack.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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