Documentation
¶
Index ¶
- type Set
- func (s *Set[T]) Add(item T) bool
- func (s *Set[T]) Contains(item T) bool
- func (s *Set[T]) Difference(x *Set[T]) *Set[T]
- func (s *Set[T]) Intersection(x *Set[T]) *Set[T]
- func (s *Set[T]) OrderedList() []T
- func (s *Set[T]) Remove(item T) bool
- func (s *Set[T]) Size() int
- func (s *Set[T]) String() string
- func (s *Set[T]) Union(x *Set[T]) *Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
Set is a minimal set that takes only ordered types: any type that supports the operators < <= >= >.
func New ¶
New returns an empty set with capacity size. The capacity will grow and shrink as a stdlib map.
func (*Set[T]) Difference ¶
Difference returns a set containing the elements of s that are not in x.
func (*Set[T]) Intersection ¶
Intersection returns a set containing the elements that are both in s and x.
func (*Set[T]) OrderedList ¶
func (s *Set[T]) OrderedList() []T
OrderedList returns a slice of the elements of s, ordered. TODO This can probably be replaced in Go 1.20 when a generics slice packages reaches the stdlib.
Click to show internal directories.
Click to hide internal directories.