set

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 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 ReadOnlySet

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

ReadOnlySet is a read-only set.

func NewReadOnly

func NewReadOnly[T comparable](values ...T) *ReadOnlySet[T]

NewReadOnly creates a new read-only set with the given values.

func (*ReadOnlySet[T]) Has

func (s *ReadOnlySet[T]) Has(value T) bool

Has returns true if the set contains the given value.

func (*ReadOnlySet[T]) Len

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

Len returns the number of elements in the set.

func (*ReadOnlySet[T]) Values

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

Values returns all the values in the set.

type Set

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

Set is a set.

func New

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

New creates a new set with the given values.

func (*Set[T]) Add

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

Add adds the given value to the set.

func (*Set[T]) Has

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

Has returns true if the set contains the given value.

func (*Set[T]) Len

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

Len returns the number of elements in the set.

func (*Set[T]) ReadOnly

func (s *Set[T]) ReadOnly() *ReadOnlySet[T]

ReadOnly returns a read-only version of the set.

func (*Set[T]) Remove

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

Remove removes the given value from the set.

func (*Set[T]) Reset

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

Reset removes all the values from the set.

func (*Set[T]) Values

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

Values returns all the values in the set.

Jump to

Keyboard shortcuts

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