Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Empty ¶
type Empty struct{}
Empty is public since it is used by some internal API objects for conversions between external string arrays and internal sets, and conversion logic requires public types today.
type Set ¶
type Set[T comparable] map[T]Empty
Set is a set of the same type elements, implemented via map[comparable]struct{} for minimal memory consumption.
func Remove ¶
func Remove[T comparable](a Set[T], sets ...Set[T]) Set[T]
Remove returns a new set with all items from the input set that are not in the other set.
func RemoveExtensions ¶
RemoveExtensions returns a new set with all items from the input set that are not an extension of another item in the set or any of the additional sets. We consider a string a prefix of another string if the other string starts with the first string followed by a period or an opening square bracket.
func RemovePrefixes ¶
RemovePrefixes returns a new set with all items from the input set that are not a prefix of another item in the set or any of the additional sets. We consider a string a prefix of another string if the other string starts with the first string followed by a period or an opening square bracket.
func Union ¶
func Union[T comparable](sets ...Set[T]) Set[T]
Union returns a new set with all items from both sets.
func (Set[T]) UnsortedList ¶
func (s Set[T]) UnsortedList() []T
UnsortedList returns the elements of the set as a list.