Documentation ¶
Index ¶
- type Iterator
- type Set
- func (s Set[T]) Add(value T)
- func (s Set[T]) Clear()
- func (s Set[T]) Clone() sets.Set[T]
- func (s Set[T]) Contains(value T) bool
- func (s Set[T]) Iterator() iter.Iterator[T]
- func (s Set[T]) Map() maps.Map[T, empty]
- func (s Set[T]) Remove(value T)
- func (s Set[T]) SetIterator() sets.Iterator[T]
- func (s Set[T]) Size() int
- func (s Set[T]) Stream(yield func(T) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iterator ¶ added in v1.3.3
type Iterator[T any] struct { // contains filtered or unexported fields }
Iterator is an iterator over a set.
func (Iterator[T]) Get ¶ added in v1.3.3
func (it Iterator[T]) Get() T
Get returns the current element.
func (Iterator[T]) Move ¶ added in v1.4.0
func (it Iterator[T]) Move()
Move moves the iterator to the next element.
type Set ¶ added in v1.4.0
type Set[T any] struct { // contains filtered or unexported fields }
Set is a set implementation based on maps. Keys are elements of the set, and values are empty structs.
func NewHashSet ¶
func NewHashSet[T comparable]() Set[T]
NewHashSet creates a new hash set for comparable types.
func NewTreeSet ¶ added in v1.4.0
NewTreeSet creates a new tree set for ordered types.
func (Set[T]) Clear ¶ added in v1.4.0
func (s Set[T]) Clear()
Clear removes all elements from the set.
func (Set[T]) Remove ¶ added in v1.4.0
func (s Set[T]) Remove(value T)
Remove removes a value from the set.
func (Set[T]) SetIterator ¶ added in v1.5.0
SetIterator returns an iterator over the set.
Click to show internal directories.
Click to hide internal directories.