set

package
v0.0.0-...-14fd01d Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package set provides a simple set implementation. Sets act like maps but only contain values.

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
}

The Set type is used like a map that only contains values. Values must implement the comparable builtin interface.

func New

func New[T comparable]() *Set[T]

New returns a new Set.

func (*Set[T]) Clear

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

Clear all entries from the Set.

func (*Set[T]) Contains

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

Contains returns true if a given value is present within the Set.

func (*Set[T]) Len

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

Len returns the number of entries within the Set.

func (*Set[T]) Put

func (s *Set[T]) Put(v T)

Put a value into the Set.

func (*Set[T]) Range

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

Range over all values in the Set.

func (*Set[T]) Remove

func (s *Set[T]) Remove(v T)

Remove a value from the Set.

func (*Set[T]) Values

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

Values returns all values within the Set.

Jump to

Keyboard shortcuts

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