Documentation ¶
Index ¶
- type Set
- func (s Set[T]) Add(v T)
- func (s Set[T]) AddAll(v ...T)
- func (s Set[T]) Clear()
- func (s Set[T]) Contains(v T) bool
- func (s Set[T]) Copy() Set[T]
- func (s Set[T]) Difference(other Set[T]) Set[T]
- func (s Set[T]) Equal(other Set[T]) bool
- func (s Set[T]) GoString() string
- 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]) Remove(v T)
- func (s Set[T]) Size() int
- func (s Set[T]) String() string
- func (s Set[T]) SymmetricDifference(other Set[T]) Set[T]
- func (s Set[T]) Union(other Set[T]) Set[T]
- func (s Set[T]) Values() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
func Of ¶ added in v0.17.0
func Of[T comparable](ts ...T) Set[T]
Of creates a new set with the given elements.
func (Set[T]) Difference ¶
Difference returns a new set with the elements that are in this set but not in the other.
func (Set[T]) Equal ¶
Equal returns true if the set is equal to the other set. Two sets are equal if they have the same elements.
func (Set[T]) Intersection ¶
Intersection returns a new set with the elements that are in both this set and the other set.
func (Set[T]) IsSubset ¶
IsSubset returns true if this set is a subset of the other set. A set is a subset if all elements of this set are also in the other set.
func (Set[T]) IsSuperset ¶
IsSuperset returns true if this set is a superset of the other set. A set is a superset if all elements of the other set are also in this set.
func (Set[T]) SymmetricDifference ¶
SymmetricDifference returns a new set with the elements that are in this set or the other set but not in both.