Documentation
¶
Index ¶
- type Float64Set
- type Float64SetWithMemoryUsage
- type Int64Set
- type Int64SetWithMemoryUsage
- type IntSet
- type Key
- type Set
- type StringSet
- func (s StringSet) Clear()
- func (s StringSet) Count() int
- func (s StringSet) Empty() bool
- func (s StringSet) Exist(val string) bool
- func (s StringSet) Insert(val string)
- func (s StringSet) Intersection(rhs StringSet) StringSet
- func (s StringSet) IntersectionWithLower(rhs StringSet, toLower bool) StringSet
- func (s StringSet) IterateWith(fn func(string))
- type StringSetWithMemoryUsage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Float64Set ¶
type Float64Set map[float64]struct{}
Float64Set is a float64 set.
func NewFloat64Set ¶
func NewFloat64Set(fs ...float64) Float64Set
NewFloat64Set builds a float64 set.
func (Float64Set) Exist ¶
func (s Float64Set) Exist(val float64) bool
Exist checks whether `val` exists in `s`.
type Float64SetWithMemoryUsage ¶
type Float64SetWithMemoryUsage struct {
hack.MemAwareMap[float64, struct{}]
}
Float64SetWithMemoryUsage is a float64 set with memory usage.
func NewFloat64SetWithMemoryUsage ¶
func NewFloat64SetWithMemoryUsage(ss ...float64) (setWithMemoryUsage Float64SetWithMemoryUsage, memDelta int64)
NewFloat64SetWithMemoryUsage builds a float64 set.
func (*Float64SetWithMemoryUsage) Insert ¶
func (s *Float64SetWithMemoryUsage) Insert(val float64) int64
Insert inserts `val` into `s` and return memDelta.
type Int64Set ¶
type Int64Set map[int64]struct{}
Int64Set is a int64 set.
type Int64SetWithMemoryUsage ¶
type Int64SetWithMemoryUsage struct {
hack.MemAwareMap[int64, struct{}]
}
Int64SetWithMemoryUsage is a int set with memory usage.
func NewInt64SetWithMemoryUsage ¶
func NewInt64SetWithMemoryUsage(ss ...int64) (setWithMemoryUsage Int64SetWithMemoryUsage, memDelta int64)
NewInt64SetWithMemoryUsage builds an int64 set.
func (*Int64SetWithMemoryUsage) Insert ¶
func (s *Int64SetWithMemoryUsage) Insert(val int64) (memDelta int64)
Insert inserts `val` into `s` and return memDelta.
type Set ¶
type Set[T Key] interface { Add(items ...T) Contains(item T) bool Remove(item T) ToList() []T Size() int Clone() Set[T] String() string }
Set is the interface for a set.
func CombSet ¶
CombSet returns all combinations of `numberOfItems` items in the given set. For example ({a, b, c}, 2) returns {ab, ac, bc}.
type StringSet ¶
type StringSet map[string]struct{}
StringSet is a string set.
func (StringSet) Intersection ¶
Intersection returns the intersection of two sets
func (StringSet) IntersectionWithLower ¶
IntersectionWithLower returns the intersection of two sets with different case of string.
func (StringSet) IterateWith ¶
IterateWith iterate items in StringSet and pass it to `fn`.
type StringSetWithMemoryUsage ¶
type StringSetWithMemoryUsage struct {
hack.MemAwareMap[string, struct{}]
// contains filtered or unexported fields
}
StringSetWithMemoryUsage is a string set with memory usage.
func NewStringSetWithMemoryUsage ¶
func NewStringSetWithMemoryUsage(ss ...string) (setWithMemoryUsage StringSetWithMemoryUsage, memDelta int64)
NewStringSetWithMemoryUsage builds a string set.
func (*StringSetWithMemoryUsage) Insert ¶
func (s *StringSetWithMemoryUsage) Insert(val string) int64
Insert inserts `val` into `s` and return memDelta.
func (*StringSetWithMemoryUsage) SetTracker ¶
func (s *StringSetWithMemoryUsage) SetTracker(t *memory.Tracker)
SetTracker sets memory tracker for StringSetWithMemoryUsage