Documentation
¶
Overview ¶
Package set contains set types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is an opaque comparable value that's used as the map key in a HandleSet. The only way to get one is to call HandleSet.Add.
type Set ¶ added in v1.42.0
type Set[T comparable] map[T]struct{}
Set is a set of T.
func SetOf ¶ added in v1.52.0
func SetOf[T comparable](slice []T) Set[T]
SetOf returns a new set constructed from the elements in slice.
func (Set[T]) AddSlice ¶ added in v1.52.0
func (s Set[T]) AddSlice(es []T)
AddSlice adds each element of es to the set.
type Slice ¶ added in v1.40.0
type Slice[T comparable] struct { // contains filtered or unexported fields }
Slice is a set of elements tracked in a slice of unique elements.
func (*Slice[T]) Add ¶ added in v1.40.0
func (ss *Slice[T]) Add(vs ...T)
Add adds each element in vs to the set. The amortized cost is O(1) per element.
func (*Slice[T]) Contains ¶ added in v1.40.0
Contains reports whether v is in the set. The amortized cost is O(1).
Click to show internal directories.
Click to hide internal directories.