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 is a generic set implementation.
func New ¶
func New[T comparable]() Set[T]
New returns a new set based on the specified generic type (must be comparable).
func (Set[T]) Add ¶
Add adds an item to the set. It returns the same set to allow easy chaining of Adds.
func (Set[T]) MustRemove ¶
func (s Set[T]) MustRemove(item T)
MustRemove removes an item from the set. However, it assumes that the item is present and it must be removed. It will panic if the item is not present.
Click to show internal directories.
Click to hide internal directories.