Documentation
¶
Overview ¶
Package set is based on public code from John Arundel, goroutine safety added. It defines goroutine-safe methods for manipulating a generic set data structure via the standard operations Add, Contains, Intersection, Members, String and Union
Index ¶
- type Set
- func (s *Set[E]) Add(vals ...E)
- func (s *Set[E]) Clear()
- func (s *Set[E]) Contains(v E) bool
- func (s *Set[E]) Delete(vals ...E)
- func (s *Set[E]) Difference(s2 *Set[E]) *Set[E]
- func (s *Set[E]) Disjoint(s2 *Set[E]) bool
- func (s *Set[E]) Empty() bool
- func (s *Set[E]) Intersection(s2 *Set[E]) *Set[E]
- func (s *Set[E]) Members() []E
- func (s *Set[E]) Size() int
- func (s *Set[E]) String() string
- func (s *Set[E]) Union(s2 *Set[E]) *Set[E]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[E comparable] struct { // contains filtered or unexported fields }
Set is a generics implementation of the set data type
func (*Set[E]) Difference ¶
Difference returns the set of values that are in s (set A) but not in s2 (set B) ... i.e. A - B
func (*Set[E]) Disjoint ¶
Disjoint returns true if the intersection of s with another set s2 is empty
func (*Set[E]) Intersection ¶
Intersection returns the logical intersection of 2 Sets
func (*Set[E]) Members ¶
func (s *Set[E]) Members() []E
Members returns a slice of the values in a Set
Click to show internal directories.
Click to hide internal directories.