Documentation
¶
Overview ¶
Package set is a template Set type
Tries to be similar to Python's set type
Index ¶
- type StringSet
- func (s *StringSet) Add(elem string) *StringSet
- func (s *StringSet) AddList(elems []string) *StringSet
- func (s *StringSet) AsList() []string
- func (s *StringSet) Clear() *StringSet
- func (s *StringSet) Contains(elem string) bool
- func (s *StringSet) Copy() *StringSet
- func (s *StringSet) Difference(other *StringSet) *StringSet
- func (s *StringSet) DifferenceUpdate(other *StringSet) *StringSet
- func (s *StringSet) Discard(elem string) *StringSet
- func (s *StringSet) Intersection(other *StringSet) *StringSet
- func (s *StringSet) IntersectionUpdate(other *StringSet) *StringSet
- func (s *StringSet) IsDisjoint(other *StringSet) bool
- func (s *StringSet) IsSubset(strict bool, other *StringSet) bool
- func (s *StringSet) IsSuperset(strict bool, other *StringSet) bool
- func (s *StringSet) Len() int
- func (s *StringSet) Pop(elem string) (string, bool)
- func (s *StringSet) Remove(elem string) bool
- func (s *StringSet) SymmetricDifference(other *StringSet) *StringSet
- func (s *StringSet) SymmetricDifferenceUpdate(other *StringSet) *StringSet
- func (s *StringSet) Union(other *StringSet) *StringSet
- func (s *StringSet) Update(other *StringSet) *StringSet
- type StringSetNothing
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringSet ¶
type StringSet struct {
// contains filtered or unexported fields
}
Set provides a general purpose set modeled on Python's set type.
func NewSizedStringSet ¶
NewSizedSet returns a new empty set with the given capacity
func (*StringSet) Add ¶
Add adds elem to the set, returning the set
If the element already exists then it has no effect
func (*StringSet) AddList ¶
AddList adds a list of elems to the set
If the elements already exists then it has no effect
func (*StringSet) Difference ¶
Difference returns a new set with all the elements that are in this set but not in the other
func (*StringSet) DifferenceUpdate ¶
DifferenceUpdate removes all the elements that are in the other set from this set. It returns the set.
func (*StringSet) Discard ¶
Discard removes elem from the set
If it wasn't in the set it does nothing
It returns the set
func (*StringSet) Intersection ¶
Intersection returns a new set with all the elements that are only in this set and the other set. It returns the new set.
func (*StringSet) IntersectionUpdate ¶
IntersectionUpdate changes this set so that it only contains elements that are in both this set and the other set. It returns the set.
func (*StringSet) IsDisjoint ¶
IsDisjoint returns a bool indicating whether this set and other set have no elements in common.
func (*StringSet) IsSubset ¶
IsSubset returns a bool indicating whether this set is a subset of other set.
func (*StringSet) IsSuperset ¶
IsSuperset returns a bool indicating whether this set is a superset of other set.
func (*StringSet) Pop ¶
Pop removes elem from the set and returns it
It also returns whether the elem was found or not
func (*StringSet) Remove ¶
Remove removes elem from the set
It returns whether the elem was in the set or not
func (*StringSet) SymmetricDifference ¶
SymmetricDifference returns a new set of all elements that are a member of exactly one of this set and other set(elements which are in one of the sets, but not in both).
func (*StringSet) SymmetricDifferenceUpdate ¶
SymmetricDifferenceUpdate modifies this set to be a set of all elements that are a member of exactly one of this set and other set(elements which are in one of the sets, but not in both) and returns this set.
type StringSetNothing ¶
type StringSetNothing struct{}
SetNothing is used as a zero sized member in the map