stack

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 0 Imported by: 0

Documentation

Overview

Package stack provides a non-thread-safe stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

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

Stack is a non-thread-safe stack.

func New

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

New creates a stack.

func (*Stack[T]) Peek

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

Peek looks at the top element of the stack.

func (*Stack[T]) Pop

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

Pop pops an element from the stack.

func (*Stack[T]) Push

func (st *Stack[T]) Push(value T)

Push pushes an element onto the stack.

func (*Stack[T]) Reset

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

Reset resets the stack.

func (*Stack[T]) Size

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

Size returns the stack size.

Jump to

Keyboard shortcuts

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