Documentation
¶
Index ¶
- type Set
- func (s *Set[T]) Add(values ...T)
- func (s *Set[T]) Clear()
- func (s *Set[T]) Clone() *Set[T]
- func (s *Set[T]) Contains(value T) bool
- func (s *Set[T]) Difference(other *Set[T]) *Set[T]
- func (s *Set[T]) Each(f func(item T) bool)
- func (s *Set[T]) Equal(other *Set[T]) bool
- func (s *Set[T]) Intersection(other *Set[T]) *Set[T]
- func (s *Set[T]) IsEmpty() bool
- func (s *Set[T]) IsSubset(other *Set[T]) bool
- func (s *Set[T]) IsSuperset(other *Set[T]) bool
- func (s *Set[T]) Len() int
- func (s *Set[T]) Remove(values ...T)
- func (s *Set[T]) String() string
- func (s *Set[T]) SymmetricDifference(other *Set[T]) *Set[T]
- func (s *Set[T]) ToSlice() []T
- func (s *Set[T]) Union(other *Set[T]) *Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
Set 是一个通用的集合(Set)数据结构。 它可以被配置为线程安全的(并发的)或非线程安全的。
必须使用 NewSet() 或 NewConcurrentSet() 来创建实例。
func NewConcurrentSet ¶ added in v0.1.8
func NewConcurrentSet[T comparable](values ...T) *Set[T]
NewConcurrentSet 线程安全的集合,可以传入初始值。
func (*Set[T]) IsSuperset ¶
IsSuperset 检查当前集合是否是另一个集合的超集。
func (*Set[T]) SymmetricDifference ¶
SymmetricDifference 对称差集。
Click to show internal directories.
Click to hide internal directories.