Documentation
¶
Index ¶
- func Map[T comparable, ResultT any](s *Set[T], f func(elem T) (ResultT, error)) ([]ResultT, error)
- type Set
- func (s *Set[T]) Add(elem T)
- func (s *Set[T]) AddSet(set2 *Set[T]) *Set[T]
- func (s *Set[T]) AsSlice() []T
- func (s *Set[T]) Clone() *Set[T]
- func (s *Set[T]) Contains(elem T) bool
- func (s *Set[T]) GetAny() T
- func (s *Set[T]) Iterate(f func(elem T) error) error
- func (s *Set[T]) Len() int
- func (s *Set[T]) Remove(elem T)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func Diff ¶
func Diff[T comparable](outer, inner *Set[T]) *Set[T]
diff two sets, return elements of outer not in inner
func FromSlice ¶
func FromSlice[T comparable](sl []T) *Set[T]
func Intersect ¶
func Intersect[T comparable](s1, s2 *Set[T]) *Set[T]
return a new set containing only elements that are present in both sets
func New ¶
func New[T comparable](sl ...T) *Set[T]
func NewSet ¶
func NewSet[T comparable]() *Set[T]
func Union ¶
func Union[T comparable](s1, s2 *Set[T]) *Set[T]
return a new set containing elements from both sets
Click to show internal directories.
Click to hide internal directories.