Documentation ¶
Index ¶
- type Comparator
- type Set
- func (theSet Set[T]) Add(members ...T) Set[T]
- func (theSet Set[T]) AsList() []T
- func (theSet Set[T]) AsSortedList() []T
- func (theSet Set[T]) Clone() Set[T]
- func (theSet Set[T]) Contains(values ...T) bool
- func (theSet Set[T]) Count() int
- func (theSet Set[T]) Equals(other Set[T]) bool
- func (theSet Set[T]) Intersect(other Set[T]) Set[T]
- func (theSet Set[T]) IsProperSubsetOf(other Set[T]) bool
- func (theSet Set[T]) IsProperSupersetOf(other Set[T]) bool
- func (theSet Set[T]) IsSubsetOf(other Set[T]) bool
- func (theSet Set[T]) IsSupersetOf(other Set[T]) bool
- func (theSet Set[T]) Minus(other Set[T]) Set[T]
- func (theSet Set[T]) String() string
- func (theSet Set[T]) Union(other Set[T]) Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparator ¶
type Comparator[T comparable] func(a, b T) bool
A comparator returns true when a < b.
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
Set represents a (mathematical) set of values, supporting the set concepts of Union, Intersection, Difference
func New ¶
func New[T comparable](members ...T) Set[T]
New returns a new Set, optionally initialized with some members
func NewWithComparator ¶
func NewWithComparator[T comparable](cmp Comparator[T], members ...T) Set[T]
NewWithComparator return a new Set and accepts a Comparator defining a sort function for members
func (Set[T]) AsSortedList ¶
func (theSet Set[T]) AsSortedList() []T
AsSortedList returns a slice of values in theSet in a stable sorted order.
func (Set[T]) Contains ¶
Contains returns a boolean indicating whether theSet contains all the given strs
func (Set[T]) Intersect ¶
Intersect returns a new Set resulting from the set intersection of theSet and other
func (Set[T]) IsProperSubsetOf ¶
func (Set[T]) IsProperSupersetOf ¶
func (Set[T]) IsSubsetOf ¶
func (Set[T]) IsSupersetOf ¶
Click to show internal directories.
Click to hide internal directories.