Discover Packages
github.com/callegarimattia/collections
stack
package
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Aug 21, 2025
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
Documentation
¶
Stack is the default, private implementation of a Stack.
New creates a new stack with an optional initial capacity.
Cap returns the capacity of the stack.
Len returns the number of elements in the stack.
Peek returns the top element of the stack without removing it.
Pop removes and returns the top element of the stack.
If the stack is empty, it returns the zero value of type T and false.
Otherwise, it returns the top element and true.
func (s *Stack [T]) Push(t T)
Push adds an element to the top of the stack.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.