Documentation
¶
Overview ¶
Package sets implement a set type as a `map[T]struct{}` but with better ergonomics.
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 implements a Set for the key type T.
func Make ¶
func Make[T comparable](size ...int) Set[T]
Make returns an empty Set of the given type. Size is optional, and if given will reserve the expected size.
func MakeWith ¶
func MakeWith[T comparable](elements ...T) Set[T]
MakeWith creates a Set[T] with the given elements inserted.
func Union ¶
func Union[T comparable](sets ...Set[T]) Set[T]
Union returns the union of all the given sets.