set

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 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
}

Set is a generic set implementation with thread safety

func NewSet

func NewSet[T comparable]() Set[T]

NewSet creates a new set

func (*Set[T]) Add

func (s *Set[T]) Add(value T)

Add adds a value to the set

func (*Set[T]) Clear

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

Clear removes all elements from the set

func (*Set[T]) Contains

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

Contains checks if a value is in the set

func (*Set[T]) Remove

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

Remove removes a value from the set

func (*Set[T]) Size

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

Size returns the number of elements in the set

func (*Set[T]) ToSlice

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

ToSlice converts the set to a slice

Jump to

Keyboard shortcuts

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