Documentation
¶
Index ¶
- func ForeachSlice[T any](f func(index int, value T), slices ...*Slice[T])
- func GoSliceJoin[T any](slices ...[]T) []T
- func SliceSetEqual[T comparable](set1, set2 []T) bool
- func SliceSetIntersection[T comparable](set1, set2 []T) []T
- func SliceSetIntersectionUncomparable[T any](set1, set2 []T, equalFunc func(a, b T) bool) []T
- type DoubleMap
- func (dm *DoubleMap[K1, K2, V]) Delete(k1 K1, k2 K2)
- func (dm *DoubleMap[K1, K2, V]) DeleteAll(k1 K1)
- func (dm *DoubleMap[K1, K2, V]) Get(k1 K1, k2 K2) (V, bool)
- func (dm *DoubleMap[K1, K2, V]) HasInnerKey(k1 K1, k2 K2) bool
- func (dm *DoubleMap[K1, K2, V]) HasKey(k1 K1) bool
- func (dm *DoubleMap[K1, K2, V]) Set(k1 K1, k2 K2, v V)
- type Map
- func (m *Map[K, V]) Delete(key K)
- func (m *Map[K, V]) Each(f func(key K, value V))
- func (m *Map[K, V]) Empty() bool
- func (m *Map[K, V]) Exists(key K) bool
- func (m *Map[K, V]) Get(key K) V
- func (m *Map[K, V]) Keys() []K
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Set(key K, value V)
- func (m *Map[K, V]) TryGet(key K) (V, bool)
- func (m *Map[K, V]) Values() []V
- type NestedArray
- type Pair
- type Set
- type Slice
- func (s *Slice[T]) Append(values ...T)
- func (s *Slice[T]) AppendSlice(b *Slice[T])
- func (s *Slice[T]) At(index int) *T
- func (s *Slice[T]) Cap() int
- func (s *Slice[T]) Clear()
- func (s *Slice[T]) Data() []T
- func (s *Slice[T]) Each(f func(index int, value T))
- func (s *Slice[T]) Filter(f func(index int, value T) bool) *Slice[T]
- func (s *Slice[T]) For(f func(index int, value T) bool)
- func (s *Slice[T]) Get(index int) T
- func (s *Slice[T]) GetUncheck(index int) T
- func (s *Slice[T]) Len() int
- func (s *Slice[T]) RemoveAt(index int)
- func (s *Slice[T]) Reverse()
- func (s *Slice[T]) Set(index int, value T) bool
- func (s *Slice[T]) Sort(less func(i int, j int) bool) *Slice[T]
- type SortedMap
- func (sm *SortedMap[K, V]) Delete(key K)
- func (sm *SortedMap[K, V]) Exists(key K) bool
- func (sm *SortedMap[K, V]) Get(key K) (V, bool)
- func (sm *SortedMap[K, V]) Keys() []K
- func (sm *SortedMap[K, V]) Len() int
- func (sm *SortedMap[K, V]) Put(key K, value V)
- func (sm *SortedMap[K, V]) Range(fn func(key K, value V) bool)
- func (sm *SortedMap[K, V]) Values() []V
- type SortedSet
- func (s *SortedSet[T]) Add(item T)
- func (s *SortedSet[T]) At(index int) *T
- func (s *SortedSet[T]) Clear()
- func (s *SortedSet[T]) Contains(item T) bool
- func (s *SortedSet[T]) Get(index int) T
- func (s *SortedSet[T]) Items() []T
- func (s *SortedSet[T]) Len() int
- func (s *SortedSet[T]) Remove(item T) bool
- type SortedSlice
- type Triple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForeachSlice ¶
func GoSliceJoin ¶
func GoSliceJoin[T any](slices ...[]T) []T
func SliceSetEqual ¶
func SliceSetEqual[T comparable](set1, set2 []T) bool
func SliceSetIntersection ¶
func SliceSetIntersection[T comparable](set1, set2 []T) []T
Types ¶
type DoubleMap ¶
type DoubleMap[K1 comparable, K2 comparable, V any] struct { // contains filtered or unexported fields }
DoubleMap is a two-level nested generic Map structure
func NewDoubleMap ¶
func NewDoubleMap[K1 comparable, K2 comparable, V any]() *DoubleMap[K1, K2, V]
func (*DoubleMap[K1, K2, V]) DeleteAll ¶
func (dm *DoubleMap[K1, K2, V]) DeleteAll(k1 K1)
DeleteAll deletes the outer key and all its inner key-values
func (*DoubleMap[K1, K2, V]) HasInnerKey ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
func NewMap ¶
func NewMap[K comparable, V any]() *Map[K, V]
type NestedArray ¶
type NestedArray[T any] struct { Data [][]T }
func NewNestedArray ¶
func NewNestedArray[T any]() *NestedArray[T]
func (*NestedArray[T]) AddRow ¶
func (n *NestedArray[T]) AddRow(row []T)
func (*NestedArray[T]) GetColLen ¶
func (n *NestedArray[T]) GetColLen(row int) int
func (*NestedArray[T]) GetRowLen ¶
func (n *NestedArray[T]) GetRowLen() int
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() *Set[T]
func NewSetFromSlice ¶
func NewSetFromSlice[T comparable](from []T) *Set[T]
type Slice ¶
type Slice[T any] struct { // contains filtered or unexported fields }
func NewSliceFromData ¶
func (*Slice[T]) AppendSlice ¶
func (*Slice[T]) GetUncheck ¶
type SortedMap ¶
type SortedMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewSortedMap ¶
func NewSortedMap[K comparable, V any]() *SortedMap[K, V]
type SortedSet ¶
type SortedSet[T comparable] struct { // contains filtered or unexported fields }
func NewSortedSet ¶
func NewSortedSet[T comparable]() *SortedSet[T]
type SortedSlice ¶
type SortedSlice[K comparable, V any] struct { // contains filtered or unexported fields }
SortedSlice 维护插入顺序,并支持通过 Key 快速检索
func NewSortedSlice ¶
func NewSortedSlice[K comparable, V any]() *SortedSlice[K, V]
NewSortedSlice 初始化
func (*SortedSlice[K, V]) GetByIndex ¶
func (s *SortedSlice[K, V]) GetByIndex(index int) V
GetByIndex 通过索引查询
func (*SortedSlice[K, V]) GetByKey ¶
func (s *SortedSlice[K, V]) GetByKey(key K) (V, bool)
GetByKey 通过 Key 快速查询: O(1)
func (*SortedSlice[K, V]) Values ¶
func (s *SortedSlice[K, V]) Values() []V
Click to show internal directories.
Click to hide internal directories.