containers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IterateMergedBinarySearchGrowingKVKeys

func IterateMergedBinarySearchGrowingKVKeys[K any, V any, W any](a *BinarySearchGrowingKV[K, V], b *BinarySearchGrowingKV[K, W]) iter.Seq[K]

func IterateSortedUniqueFuncUnique

func IterateSortedUniqueFuncUnique[T any](s1 []T, s2 []T, compare func(a, b T) int) iter.Seq[T]

func IterateSortedUniqueOrderedUnique

func IterateSortedUniqueOrderedUnique[T constraints.Ordered](s1 []T, s2 []T) iter.Seq[T]

Types

type BinarySearchGrowingKV

type BinarySearchGrowingKV[K any, V any] struct {
	// contains filtered or unexported fields
}

func NewBinarySearchGrowingKV

func NewBinarySearchGrowingKV[K any, V any](estSize int, cmpKey func(a K, b K) int) (inst *BinarySearchGrowingKV[K, V])

func (*BinarySearchGrowingKV[K, V]) Get

func (inst *BinarySearchGrowingKV[K, V]) Get(key K) (val V, has bool)

func (*BinarySearchGrowingKV[K, V]) GetDefault

func (inst *BinarySearchGrowingKV[K, V]) GetDefault(key K, defaultV V) (val V)

func (*BinarySearchGrowingKV[K, V]) Has

func (inst *BinarySearchGrowingKV[K, V]) Has(key K) (has bool)

func (*BinarySearchGrowingKV[K, V]) IterateKeys

func (inst *BinarySearchGrowingKV[K, V]) IterateKeys() iter.Seq[K]

func (*BinarySearchGrowingKV[K, V]) IteratePairs

func (inst *BinarySearchGrowingKV[K, V]) IteratePairs() iter.Seq2[K, V]

func (*BinarySearchGrowingKV[K, V]) IterateValues

func (inst *BinarySearchGrowingKV[K, V]) IterateValues() iter.Seq[V]

func (*BinarySearchGrowingKV[K, V]) Len

func (inst *BinarySearchGrowingKV[K, V]) Len() int

func (*BinarySearchGrowingKV[K, V]) Less

func (inst *BinarySearchGrowingKV[K, V]) Less(i, j int) bool

func (*BinarySearchGrowingKV[K, V]) MergeValue

func (inst *BinarySearchGrowingKV[K, V]) MergeValue(key K, val V, merge func(old V, new V) V) (existed bool)

func (*BinarySearchGrowingKV[K, V]) Reset

func (inst *BinarySearchGrowingKV[K, V]) Reset()

func (*BinarySearchGrowingKV[K, V]) Swap

func (inst *BinarySearchGrowingKV[K, V]) Swap(i, j int)

func (*BinarySearchGrowingKV[K, V]) UpsertBatch

func (inst *BinarySearchGrowingKV[K, V]) UpsertBatch(key K, val V)

UpsertBatch last write wins

func (*BinarySearchGrowingKV[K, V]) UpsertSingle

func (inst *BinarySearchGrowingKV[K, V]) UpsertSingle(key K, val V) (existed bool)

type HashSet

type HashSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewHashSet

func NewHashSet[T comparable](estimatedCard int) *HashSet[T]

func (*HashSet[T]) Add

func (inst *HashSet[T]) Add(val T)

func (*HashSet[T]) AddEx

func (inst *HashSet[T]) AddEx(val T) (existed bool)

func (*HashSet[T]) AddExMany

func (inst *HashSet[T]) AddExMany(vals iter.Seq[T]) (existing int, nonExisting int)

func (*HashSet[T]) AddMany

func (inst *HashSet[T]) AddMany(vals iter.Seq[T]) (added int)

func (*HashSet[T]) Clear

func (inst *HashSet[T]) Clear()

func (*HashSet[T]) DifferenceMod

func (inst *HashSet[T]) DifferenceMod(other *HashSet[T])

func (*HashSet[T]) Equal

func (inst *HashSet[T]) Equal(other HashSet[T]) bool

func (*HashSet[T]) Has

func (inst *HashSet[T]) Has(val T) bool

func (*HashSet[T]) IntersectMod

func (inst *HashSet[T]) IntersectMod(other *HashSet[T])

func (*HashSet[T]) IterateAll

func (inst *HashSet[T]) IterateAll() iter.Seq[T]

func (*HashSet[T]) Remove

func (inst *HashSet[T]) Remove(val T)

func (*HashSet[T]) RemoveEx

func (inst *HashSet[T]) RemoveEx(val T) (had bool)

func (*HashSet[T]) Size

func (inst *HashSet[T]) Size() int

func (*HashSet[T]) Slice

func (inst *HashSet[T]) Slice() []T

func (*HashSet[T]) SliceEx

func (inst *HashSet[T]) SliceEx(in []T) (out []T)

func (*HashSet[T]) UnionMod

func (inst *HashSet[T]) UnionMod(other *HashSet[T])

type Stack

type Stack[T any] struct {
	Items []T
}

func NewStack

func NewStack[T any]() *Stack[T]

func NewStackSized

func NewStackSized[T any](n int) *Stack[T]

func (*Stack[T]) Depth

func (stack *Stack[T]) Depth() int

func (*Stack[T]) Peek

func (stack *Stack[T]) Peek() (retr T, err error)

func (*Stack[T]) PeekDefault

func (stack *Stack[T]) PeekDefault(emptyValue T) (retr T)

func (*Stack[T]) Pop

func (stack *Stack[T]) Pop() (retr T, err error)

func (*Stack[T]) PopDefault

func (stack *Stack[T]) PopDefault(emptyValue T) (retr T)

func (*Stack[T]) Push

func (stack *Stack[T]) Push(value T)

func (*Stack[T]) Reset

func (stack *Stack[T]) Reset()

func (*Stack[T]) Swap

func (stack *Stack[T]) Swap(newValue T) (oldValue T, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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