Documentation ¶
Index ¶
- func AreEqual[T comparable](left, right Set[T]) bool
- func AsSortedSlice[T constraints.Ordered](set Set[T]) []T
- type Set
- func (set Set[T]) Add(x T)
- func (set Set[T]) AddAll(x Set[T])
- func (set Set[T]) Clear()
- func (set Set[T]) Contains(x T) bool
- func (set Set[T]) Copy() Set[T]
- func (set Set[T]) Equals(other Set[T]) bool
- func (set Set[T]) Except(other Set[T]) Set[T]
- func (set Set[T]) Remove(x T)
- func (set Set[T]) Values() []T
- func (set Set[T]) Where(predicate func(T) bool) Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreEqual ¶
func AreEqual[T comparable](left, right Set[T]) bool
func AsSortedSlice ¶
func AsSortedSlice[T constraints.Ordered](set Set[T]) []T
AsSortedSlice returns a sorted slice of values from this set
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set provides a standard way to have a set of distinct things
func (Set[T]) Add ¶
func (set Set[T]) Add(x T)
Add adds the provided value into the set Nothing happens if the value is already present
func (Set[T]) AddAll ¶
AddAll adds the provided set into the existing set. Nothing happens for values which are already present
func (Set[T]) Except ¶ added in v2.2.0
Except returns a new set with only the set of values which are not in the other set
func (Set[T]) Remove ¶
func (set Set[T]) Remove(x T)
Remove deletes the provided value from the set Nothing happens if the value is not present
Click to show internal directories.
Click to hide internal directories.