Documentation
¶
Overview ¶
Package sets contains set data structures.
Index ¶
- type SizeLimitedStringSet
- type SortedString
- func (s *SortedString) Add(elements ...string)
- func (s *SortedString) Clear()
- func (s *SortedString) Delete(element string)
- func (s *SortedString) ForEach(callback func(element string) bool)
- func (s *SortedString) Has(element string) bool
- func (s *SortedString) Size() int
- func (s *SortedString) ToSlice() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SizeLimitedStringSet ¶
type SizeLimitedStringSet struct {
// contains filtered or unexported fields
}
A SizeLimitedStringSet is a StringSet which is limited to a given size. Once the capacity is reached an element will be removed at random.
func NewSizeLimitedStringSet ¶
func NewSizeLimitedStringSet(capacity int) *SizeLimitedStringSet
NewSizeLimitedStringSet create a new SizeLimitedStringSet.
func (*SizeLimitedStringSet) Add ¶
func (s *SizeLimitedStringSet) Add(element string)
Add adds an element to the set.
func (*SizeLimitedStringSet) ForEach ¶
func (s *SizeLimitedStringSet) ForEach(callback func(element string) bool)
ForEach iterates over all the elements in the set.
type SortedString ¶
type SortedString struct {
// contains filtered or unexported fields
}
A SortedString is a set of strings with sorted iteration.
func NewSortedString ¶
func NewSortedString() *SortedString
NewSortedString creates a new sorted string set.
func (*SortedString) Add ¶
func (s *SortedString) Add(elements ...string)
Add adds a string to the set.
func (*SortedString) Delete ¶
func (s *SortedString) Delete(element string)
Delete deletes an element from the set.
func (*SortedString) ForEach ¶
func (s *SortedString) ForEach(callback func(element string) bool)
ForEach iterates over the set in ascending order.
func (*SortedString) Has ¶
func (s *SortedString) Has(element string) bool
Has returns true if the elment is in the set.
func (*SortedString) ToSlice ¶
func (s *SortedString) ToSlice() []string
ToSlice returns a slice of all the elements in the set.