Documentation
¶
Index ¶
- type InsertionOrderedMap
- func (m *InsertionOrderedMap[K, V]) Clear()
- func (m *InsertionOrderedMap[K, V]) Copy() *InsertionOrderedMap[K, V]
- func (m *InsertionOrderedMap[K, V]) Delete(key K)
- func (m *InsertionOrderedMap[K, V]) Get(key K) (V, bool)
- func (m *InsertionOrderedMap[K, V]) GetByIndex(index int) (K, V, bool)
- func (m *InsertionOrderedMap[K, V]) GetKeyIndex(key K) (int, bool)
- func (m *InsertionOrderedMap[K, V]) Iter() func(func(k K, v V) bool)
- func (m *InsertionOrderedMap[K, V]) Keys() []K
- func (m *InsertionOrderedMap[K, V]) Len() int
- func (m *InsertionOrderedMap[K, V]) Range(f func(key K, value V))
- func (m *InsertionOrderedMap[K, V]) Set(key K, value V)
- func (m *InsertionOrderedMap[K, V]) String() string
- func (m *InsertionOrderedMap[K, V]) Values() []V
- type InsertionOrderedSet
- func (s *InsertionOrderedSet[T]) Add(element T)
- func (s *InsertionOrderedSet[T]) Clear()
- func (s *InsertionOrderedSet[T]) Contains(element T) bool
- func (s *InsertionOrderedSet[T]) Difference(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
- func (s *InsertionOrderedSet[T]) Elements() []T
- func (s *InsertionOrderedSet[T]) Intersection(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
- func (s *InsertionOrderedSet[T]) Remove(element T)
- func (s *InsertionOrderedSet[T]) Size() int
- func (s *InsertionOrderedSet[T]) String() string
- func (s *InsertionOrderedSet[T]) Union(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
- type KeySortedMap
- func (sm *KeySortedMap[K, V]) Clear()
- func (sm *KeySortedMap[K, V]) Get(key K) (V, bool)
- func (sm *KeySortedMap[K, V]) Insert(key K, value V)
- func (sm *KeySortedMap[K, V]) Iter() iter.Seq2[K, V]
- func (sm *KeySortedMap[K, V]) Keys() []K
- func (sm *KeySortedMap[K, V]) Len() int
- func (sm *KeySortedMap[K, V]) ReverseIter() iter.Seq2[K, V]
- type Set
- type SortedSet
- func (ss *SortedSet[K]) Clear()
- func (ss *SortedSet[K]) Has(key K) bool
- func (ss *SortedSet[K]) Insert(key K)
- func (ss *SortedSet[K]) Iter() iter.Seq[K]
- func (ss *SortedSet[K]) Len() int
- func (ss *SortedSet[K]) ReverseIter() iter.Seq2[K, struct{}]
- func (ss *SortedSet[K]) Slice() []K
- func (ss *SortedSet[K]) String() string
- type SyncMap
- func (sm *SyncMap[K, V]) Delete(key K)
- func (sm *SyncMap[K, V]) Get(key K) (V, bool)
- func (sm *SyncMap[K, V]) Iter() func(yield func(k K, v V) bool)
- func (sm *SyncMap[K, V]) Len() int
- func (sm *SyncMap[K, V]) MustGet(key K) V
- func (sm *SyncMap[K, V]) Range(f func(key K, value V) bool)
- func (sm *SyncMap[K, V]) Set(key K, value V)
- type SyncSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InsertionOrderedMap ¶
type InsertionOrderedMap[K comparable, V any] struct { // contains filtered or unexported fields }
InsertionOrderedMap represents a map that maintains insertion order
func NewInsertionOrderedMap ¶
func NewInsertionOrderedMap[K comparable, V any]() *InsertionOrderedMap[K, V]
New creates and returns a new InsertionOrderedMap
func (*InsertionOrderedMap[K, V]) Clear ¶
func (m *InsertionOrderedMap[K, V]) Clear()
Clear removes all elements from the map
func (*InsertionOrderedMap[K, V]) Copy ¶
func (m *InsertionOrderedMap[K, V]) Copy() *InsertionOrderedMap[K, V]
func (*InsertionOrderedMap[K, V]) Delete ¶
func (m *InsertionOrderedMap[K, V]) Delete(key K)
Delete removes a key-value pair from the map
func (*InsertionOrderedMap[K, V]) Get ¶
func (m *InsertionOrderedMap[K, V]) Get(key K) (V, bool)
Get retrieves a value from the map by key
func (*InsertionOrderedMap[K, V]) GetByIndex ¶
func (m *InsertionOrderedMap[K, V]) GetByIndex(index int) (K, V, bool)
GetByIndex returns the key-value pair at the given index
func (*InsertionOrderedMap[K, V]) GetKeyIndex ¶
func (m *InsertionOrderedMap[K, V]) GetKeyIndex(key K) (int, bool)
GetKeyIndex returns the index of a key in the ordered list of keys
func (*InsertionOrderedMap[K, V]) Iter ¶
func (m *InsertionOrderedMap[K, V]) Iter() func(func(k K, v V) bool)
func (*InsertionOrderedMap[K, V]) Keys ¶
func (m *InsertionOrderedMap[K, V]) Keys() []K
Keys returns a slice of all keys in the map, in order
func (*InsertionOrderedMap[K, V]) Len ¶
func (m *InsertionOrderedMap[K, V]) Len() int
Len returns the number of elements in the map
func (*InsertionOrderedMap[K, V]) Range ¶
func (m *InsertionOrderedMap[K, V]) Range(f func(key K, value V))
Range iterates over the map in order, calling the given function for each key-value pair
func (*InsertionOrderedMap[K, V]) Set ¶
func (m *InsertionOrderedMap[K, V]) Set(key K, value V)
Set adds a key-value pair to the map
func (*InsertionOrderedMap[K, V]) String ¶
func (m *InsertionOrderedMap[K, V]) String() string
String returns a string representation of the map
func (*InsertionOrderedMap[K, V]) Values ¶
func (m *InsertionOrderedMap[K, V]) Values() []V
Values returns a slice of all values in the map, in order
type InsertionOrderedSet ¶
type InsertionOrderedSet[T comparable] struct { // contains filtered or unexported fields }
InsertionOrderedSet represents a set that maintains insertion order
func NewInsertionOrderedSet ¶
func NewInsertionOrderedSet[T comparable]() *InsertionOrderedSet[T]
func (*InsertionOrderedSet[T]) Add ¶
func (s *InsertionOrderedSet[T]) Add(element T)
Add adds an element to the set if it doesn't already exist
func (*InsertionOrderedSet[T]) Clear ¶
func (s *InsertionOrderedSet[T]) Clear()
Clear removes all elements from the set
func (*InsertionOrderedSet[T]) Contains ¶
func (s *InsertionOrderedSet[T]) Contains(element T) bool
Contains checks if an element exists in the set
func (*InsertionOrderedSet[T]) Difference ¶
func (s *InsertionOrderedSet[T]) Difference(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
Difference returns a new InsertionOrderedSet containing elements in s that are not in other
func (*InsertionOrderedSet[T]) Elements ¶
func (s *InsertionOrderedSet[T]) Elements() []T
Elements returns a slice of all elements in the set, in order
func (*InsertionOrderedSet[T]) Intersection ¶
func (s *InsertionOrderedSet[T]) Intersection(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
Intersection returns a new InsertionOrderedSet containing elements common to both sets
func (*InsertionOrderedSet[T]) Remove ¶
func (s *InsertionOrderedSet[T]) Remove(element T)
Remove removes an element from the set
func (*InsertionOrderedSet[T]) Size ¶
func (s *InsertionOrderedSet[T]) Size() int
Size returns the number of elements in the set
func (*InsertionOrderedSet[T]) String ¶
func (s *InsertionOrderedSet[T]) String() string
String returns a string representation of the set
func (*InsertionOrderedSet[T]) Union ¶
func (s *InsertionOrderedSet[T]) Union(other *InsertionOrderedSet[T]) *InsertionOrderedSet[T]
Union returns a new InsertionOrderedSet containing all elements from both sets
type KeySortedMap ¶
KeySortedMap is a map that maintains keys in sorted order.
func NewKeySortedMap ¶
func NewKeySortedMap[K cmp.Ordered, V any]() *KeySortedMap[K, V]
func (*KeySortedMap[K, V]) Clear ¶
func (sm *KeySortedMap[K, V]) Clear()
func (*KeySortedMap[K, V]) Get ¶
func (sm *KeySortedMap[K, V]) Get(key K) (V, bool)
func (*KeySortedMap[K, V]) Insert ¶
func (sm *KeySortedMap[K, V]) Insert(key K, value V)
func (*KeySortedMap[K, V]) Iter ¶
func (sm *KeySortedMap[K, V]) Iter() iter.Seq2[K, V]
func (*KeySortedMap[K, V]) Keys ¶
func (sm *KeySortedMap[K, V]) Keys() []K
func (*KeySortedMap[K, V]) Len ¶
func (sm *KeySortedMap[K, V]) Len() int
func (*KeySortedMap[K, V]) ReverseIter ¶
func (sm *KeySortedMap[K, V]) ReverseIter() iter.Seq2[K, V]
type Set ¶
type Set[T comparable] map[T]struct{}
func NewSet ¶
func NewSet[T comparable]() Set[T]
func NewSetFrom ¶
func NewSetFrom[T comparable](xs []T) Set[T]
type SortedSet ¶
type SortedSet[K cmp.Ordered] KeySortedMap[K, struct{}]
func NewSortedSet ¶
func (*SortedSet[K]) ReverseIter ¶
type SyncMap ¶
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewSyncMap ¶
func NewSyncMap[K comparable, V any]() *SyncMap[K, V]
type SyncSet ¶
type SyncSet[T comparable] struct { // contains filtered or unexported fields }
func NewSyncSet ¶
func NewSyncSet[T comparable]() *SyncSet[T]