set

package
v0.0.0-...-f6fec3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T comparable](items ...T) *Set[T]

func (*Set[T]) Add

func (s *Set[T]) Add(items ...T)

func (*Set[T]) All

func (s *Set[T]) All() iter.Seq[T]

All returns an iterator over all elements in the set.

func (*Set[T]) Contains

func (s *Set[T]) Contains(item T) bool

func (*Set[T]) Difference

func (s *Set[T]) Difference(other *Set[T]) *Set[T]

Difference returns a new set with elements in s that are not in other.

func (*Set[T]) Intersection

func (s *Set[T]) Intersection(other *Set[T]) *Set[T]

Intersection returns a new set with elements common to both s and other.

func (*Set[T]) Len

func (s *Set[T]) Len() int

func (*Set[T]) Merge

func (s *Set[T]) Merge(other *Set[T])

Merge adds all elements from other into s.

func (*Set[T]) Remove

func (s *Set[T]) Remove(items ...T)

func (*Set[T]) Slice

func (s *Set[T]) Slice() []T

Slice returns all elements as a slice (unordered).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL