stack

package
v0.0.0-...-4b9bf86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package stack provides a normal (=non-concurrency-safe) stack for anything (interface{})

Note: the very crisp implementation was found in cmd/go/pkg.go importStack

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack []interface{}

Stack implements a normal (=non-concurrency-safe) stack for anything (interface{}) based on a slice, and never shrinking

func New

func New(cap int) *Stack

New returns a new empty stack with given initial capacity

func (*Stack) Drop

func (s *Stack) Drop()

Drop pops sth silently off the current stack

func (*Stack) Get

func (s *Stack) Get() []interface{}

Get returns a copy of the current stack

func (*Stack) Init

func (s *Stack) Init(cap int) *Stack

Init returns an empty stack with given initial capacity

func (*Stack) Len

func (s *Stack) Len() int

Len returns the length of the current stack

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop sth off the current stack

func (*Stack) Push

func (s *Stack) Push(l interface{})

Push sth onto the current stack

func (*Stack) Top

func (s *Stack) Top() interface{}

Top returns the top of the current stack

Jump to

Keyboard shortcuts

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