package
Version:
v0.2.1
Opens a new window with list of versions in this module.
Published: Jul 13, 2023
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Stack[T any] struct {
}
Stack represents a stack.
Zero value of Stack is empty stack.
New returns an initialized stack.
func (s *Stack[T]) All() []T
All returns all elements from the stack.
func (s *Stack[T]) Peek() T
Peek returns element on top of stack.
func (s *Stack[T]) Pop() T
Pop removes the most recently added element.
func (s *Stack[T]) Push(value T)
Push adds element.
Size returns size of the stack.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.