Documentation ¶
Overview ¶
Package stringset implements Set operations on strings.
Index ¶
- type Set
- func (set Set) Add(s string) bool
- func (set Set) Cardinality() int
- func (set Set) Clone() Set
- func (set Set) Contains(s string) bool
- func (set Set) ContainsAll(s ...string) bool
- func (set Set) Difference(other Set) Set
- func (set Set) Equal(other Set) bool
- func (set Set) Intersect(other Set) Set
- func (set Set) IsSubset(other Set) bool
- func (set Set) Remove(i string)
- func (set Set) SymmetricDifference(other Set) Set
- func (set Set) ToSlice() []string
- func (set Set) Union(other Set) Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set map[string]struct{}
Set provides operations like union, intersect, difference on Sets with strings.
func NewFromStringMap ¶
NewFromStringMap collects the keys of a [string]string and returns a Set of strings.
func (Set) Cardinality ¶
Cardinality returns how many items are currently in the set.
func (Set) ContainsAll ¶
ContainsAll returns true if all s's are in the receiver.
func (Set) Difference ¶
Difference returns a set with items in the receiver that are not in other.
func (Set) Equal ¶
Equal determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal.
func (Set) SymmetricDifference ¶
SymmetricDifference returns a new set with items of the receiver or other that are not in both sets.