Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
Set represents a collection of unique elements
func NewSet ¶
func NewSet[T comparable]() *Set[T]
NewSet creates and initializes a new set
Returns:
- a new set
func (*Set[T]) Add ¶
func (s *Set[T]) Add(value T)
Add inserts an element into the set
Parameters:
- value: the element to insert
func (*Set[T]) Clear ¶
func (s *Set[T]) Clear()
Clear removes all elements from the set
Parameters:
- s: the set
func (*Set[T]) Contains ¶
Contains checks if the set contains the specified element
Parameters:
- value: the element to check
func (*Set[T]) Elements ¶
func (s *Set[T]) Elements() []T
Elements returns a slice of all elements in the set
Returns:
- a slice of all elements in the set
Click to show internal directories.
Click to hide internal directories.