atomicstack

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 2 Imported by: 0

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 New

func New[T any]() *AtomicStack[T]

New function Creates a new Thread-Safe Stack.

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.

Jump to

Keyboard shortcuts

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