Documentation
¶
Overview ¶
Package set provides a bog standard set implementation for Go, just a wrapper around a map[T comparable]struct{} Most set methods mutate the set and return it to facilitate method chaining. Not thread safe.
Index ¶
- func ToSeq[T any](v ...T) iter.Seq[T]
- type Set
- func (a Set[T]) Add(values ...T) Set[T]
- func (a Set[T]) All() iter.Seq[T]
- func (a Set[T]) Difference(b iter.Seq[T]) Set[T]
- func (a Set[T]) Has(values ...T) bool
- func (a Set[T]) HasAll(b iter.Seq[T]) bool
- func (a Set[T]) HasAny(b iter.Seq[T]) bool
- func (a Set[T]) Intersects(b iter.Seq[T]) Set[T]
- func (a Set[T]) Union(b iter.Seq[T]) Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
func From ¶
func From[T comparable](vals ...T) Set[T]
From creates a set from the comparable values passed in.
func FromSeq ¶
func FromSeq[T comparable](vals iter.Seq[T]) Set[T]
FromSeq creates a set from the comparable values passed in via iter.Seq.
func (Set[T]) Difference ¶
Difference returns the difference of the set and sequence
func (Set[T]) HasAll ¶
HasAll returns a boolean indicating whether the set contains all of the sequence.
func (Set[T]) HasAny ¶
HasAny returns a boolean indicating whether the set contains any of the sequence.
func (Set[T]) Intersects ¶
Intersects returns a new set that is the intersection of the set and sequence
Click to show internal directories.
Click to hide internal directories.