Documentation ¶
Index ¶
- type IntSet
- type Set
- func (s Set) Contains(item string) bool
- func (s Set) Copy() Set
- func (s Set) Delete(item string) Set
- func (s Set) DeleteAll(items ...string) Set
- func (s Set) Difference(s2 Set) Set
- func (s Set) Equals(other Set) bool
- func (s Set) Insert(item string) Set
- func (s Set) InsertAll(items ...string) Set
- func (s Set) Intersection(s2 Set) Set
- func (s Set) IsEmpty() bool
- func (s Set) Len() int
- func (s Set) Merge(s2 Set) Set
- func (s Set) SortedList() []string
- func (s Set) SupersetOf(s2 Set) bool
- func (s Set) Union(s2 Set) Set
- func (s Set) UnsortedList() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IntSet ¶
type IntSet map[int]struct{}
func NewIntSetWithLength ¶
NewIntSetWithLength returns an empty Set with the given capacity. It's only a hint, not a limitation.
type Set ¶
type Set map[string]struct{}
func NewWithLength ¶
NewWithLength returns an empty Set with the given capacity. It's only a hint, not a limitation.
func (Set) Difference ¶
Difference returns a set of objects that are not in s2 For example: s = {a1, a2, a3} s2 = {a1, a2, a4, a5} s.Difference(s2) = {a3} s2.Difference(s) = {a4, a5}
func (Set) Intersection ¶
Intersection returns a set of objects that are common between s and s2 For example: s = {a1, a2, a3} s2 = {a1, a2, a4, a5} s.Intersection(s2) = {a1, a2}
func (Set) Merge ¶
Merge a set of objects that are in s2 into s For example: s = {a1, a2, a3} s2 = {a3, a4, a5} s.Merge(s2) = {a1, a2, a3, a4, a5}
func (Set) SortedList ¶
SortedList returns the slice with contents sorted.
func (Set) SupersetOf ¶
SupersetOf returns true if s contains all elements of s2 For example: s = {a1, a2, a3} s2 = {a1, a2, a3, a4, a5} s.SupersetOf(s2) = false s2.SupersetOf(s) = true
func (Set) Union ¶
Union returns a set of objects that are in s or s2 For example: s = {a1, a2, a3} s2 = {a1, a2, a4, a5} s.Union(s2) = s2.Union(s) = {a1, a2, a3, a4, a5}
func (Set) UnsortedList ¶
UnsortedList returns the slice with contents in random order.