Documentation
¶
Overview ¶
Package atomicstack package contains functions, methods and types for using AtomicStacks. An AtomicStack is a thread-safe Last-in First-out stack implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicStack ¶
type AtomicStack[T any] struct { // contains filtered or unexported fields }
AtomicStack is a Thread-Safe Stack Implementation which follows the LIFO Principle.
func (*AtomicStack[T]) Len ¶
func (s *AtomicStack[T]) Len() int
Len Method for getting the length of the Stack.
func (*AtomicStack[T]) Peek ¶
func (s *AtomicStack[T]) Peek() (T, bool)
Peek Method for getting the last element which was pushed without removing it. Returns T and bool, where T is the element and bool indicates if all went right. Like Pop, Bool could be false if the Stack is empty (doesn't exist).
func (*AtomicStack[T]) Pop ¶
func (s *AtomicStack[T]) Pop() (T, bool)
Pop Method for getting the last element which was pushed into the stack. Returns T and bool, where T is the element, and bool indicates if all went right. Bool could be false if the Stack is empty, for example.
func (*AtomicStack[T]) Push ¶
func (s *AtomicStack[T]) Push(item T)
Push Method for pushing an element into the Stack.