set¶
Index¶
- type Set
- func NewSet[T cmp.Ordered]() *Set[T]
- func (s *Set[T]) Add(value T)
- func (s *Set[T]) Clear()
- func (s *Set[T]) Contains(value T) bool
- func (s *Set[T]) Diff(sets ...*Set[T]) *Set[T]
- func (s *Set[T]) Remove(value T)
- func (s *Set[T]) Size() int
- func (s *Set[T]) Update(sets ...*Set[T])
- func (s *Set[T]) Values() []T
- func (s *Set[T]) ValuesSorted() []T
type Set¶
Set is a simple implementation of a set using a map.
func NewSet¶
NewSet creates and returns a new set.
func (*Set[T]) Add¶
Add inserts an element into the set.
func (*Set[T]) Clear¶
Clear removes all elements from the set.
func (*Set[T]) Contains¶
Contains checks if an element exists in the set.
func (*Set[T]) Diff¶
Diff returns a new set containing elements that are in the current set but not in the provided sets.
func (*Set[T]) Remove¶
Remove deletes an element from the set.
func (*Set[T]) Size¶
Size returns the number of elements in the set.
func (*Set[T]) Update¶
Update adds all elements from the given sets into the current set.
func (*Set[T]) Values¶
Values returns all elements in the set as a slice.
func (*Set[T]) ValuesSorted¶
ValuesSorted returns all elements in the set as a sorted slice.
Generated by gomarkdoc