stack

package
v0.0.0-...-5ac3f74 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: Apache-2.0 Imports: 0 Imported by: 4

Documentation

Overview

Package stack is a tiny package implementing a generic stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack[T any] []T

A Stack.

func (*Stack[T]) Len

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

Len returns the number of elements on the stack.

func (*Stack[T]) Pop

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

Pop returns the topmost element from the stack and removes it. Panics if the stack is empty.

func (*Stack[T]) Push

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

Push v unto the stack.

func (*Stack[T]) Top

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

Top returns the topmost element of the stack without removing it. Panics if the stack is empty.

Jump to

Keyboard shortcuts

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