Documentation
¶
Index ¶
- func SortedSlice[E constraints.Ordered](set Set[E]) []E
- type Empty
- type Set
- func (s Set[E]) Delete(items ...E) Set[E]
- func (s Set[E]) Difference(other Set[E]) Set[E]
- func (s Set[E]) Equal(other Set[E]) bool
- func (s Set[E]) Has(item E) bool
- func (s Set[E]) HasAll(items ...E) bool
- func (s Set[E]) HasAny(items ...E) bool
- func (s Set[E]) Insert(items ...E) Set[E]
- func (s Set[E]) Intersection(other Set[E]) Set[E]
- func (s Set[E]) IsSuperset(other Set[E]) bool
- func (s Set[E]) Len() int
- func (s Set[E]) PopAny() (E, bool)
- func (s Set[E]) Slice() []E
- func (s Set[E]) Union(other Set[E]) Set[E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortedSlice ¶ added in v0.6.4
func SortedSlice[E constraints.Ordered](set Set[E]) []E
SortedSlice takes a Set with constraints.Ordered items and returns a sorted slice of the items.
Types ¶
type Set ¶
type Set[E comparable] map[E]Empty
Set is a set of unique values.
func (Set[E]) Difference ¶
Difference returns a set of objects that are not in other For example: s = {a1, a2, a3} other = {a1, a2, a4, a5} s.Difference(other) = {a3} other.Difference(s) = {a4, a5}
func (Set[E]) Equal ¶
Equal returns true if and only if s is equal (as a set) to other. Two sets are equal if their membership is identical. (In practice, this means same elements, order doesn't matter)
func (Set[E]) Intersection ¶
Intersection returns a new set which includes the item in BOTH s and other For example: s = {a1, a2} other = {a2, a3} s.Intersection(other) = {a2}
func (Set[E]) IsSuperset ¶
IsSuperset returns true if and only if s is a superset of other.