lysset

package
v0.3.56 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 0 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] map[T]struct{}

Set is a simple set implementation using a map with empty struct values.

func FromSlice

func FromSlice[T comparable](vals []T) Set[T]

FromSlice returns a set built from vals. Only use this if the element order is irrelevant.

func New

func New[T comparable](vals ...T) Set[T]

New returns a set containing the supplied values.

func (*Set[T]) Add

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

Add inserts val into the set.

func (*Set[T]) AddAll

func (s *Set[T]) AddAll(vals ...T)

AddAll inserts each supplied value into the set.

func (*Set[T]) Clear

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

Clear removes all values from the set.

func (Set[T]) Clone

func (s Set[T]) Clone() Set[T]

Clone returns a copy of the set.

func (Set[T]) Contains

func (s Set[T]) Contains(val T) bool

Contains returns true if val exists in the set.

func (Set[T]) Equals

func (s Set[T]) Equals(other Set[T]) bool

Equals returns true when both sets have the same values.

func (Set[T]) Len

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

Len returns the number of values in the set.

func (*Set[T]) Remove

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

Remove deletes val from the set.

func (Set[T]) Values

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

Values returns the set members in an unspecified order.

Jump to

Keyboard shortcuts

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