Documentation
¶
Index ¶
- type StringSet
- func (set StringSet) Add(s string) bool
- func (set StringSet) Difference(otherSet StringSet) StringSet
- func (set StringSet) Exists(s string) bool
- func (set StringSet) Intersection(otherSet StringSet) StringSet
- func (set StringSet) Remove(s string) bool
- func (set StringSet) Union(otherSet StringSet) StringSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringSet ¶
type StringSet map[string]struct{}
StringSet is a set of strings, supporting basic set and inter-set operations. The StringSet is abstracted on top of a map[string]struct{}, so it also supports range-style iteration, as well as direct map operations. The implementation is not thread-safe.
func NewDefaultStringSet ¶
func NewDefaultStringSet() StringSet
NewDefaultStringSet creates a new StringSet with a default initial capacity.
func NewStringSet ¶
NewStringSet creates a new StringSet with the specified initial capacity.
func (StringSet) Add ¶
Add the given string to the set. Returns true if the set has changed, and false otherwise.
func (StringSet) Difference ¶
Difference creates a set containing all elements in the receiver set which are not in the given set.
func (StringSet) Exists ¶
Exists returns whether the given string is in the set.
func (StringSet) Intersection ¶
Intersection creates a set containing all elements in both the receiver set and the given set.
func (StringSet) Remove ¶
Remove the given string from the set. Returns true if the set has changed, and false otherwise.