Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set represents a generic set data structure.
func New ¶
func New[T comparable](elements ...T) Set[T]
New creates a new set and initializes it with the provided elements.
func Union ¶ added in v0.72.0
func Union[T comparable](sets ...Set[T]) Set[T]
Union merges the given sets into a new set containing all unique elements from the input sets.
func (Set[T]) Add ¶
func (s Set[T]) Add(elements ...T)
Add inserts the specified elements into the set.
func (Set[T]) Difference ¶ added in v0.77.0
Difference returns a new set containing the elements in s that are not in other.
Click to show internal directories.
Click to hide internal directories.