set

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2025 License: BSD-3-Clause 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 generic set implementation

func NewSet

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

NewSet creates a new set with optional initial capacity

func (Set[T]) Add

func (s Set[T]) Add(elts ...T)

Add adds an element 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(elt T) bool

Contains returns true if the element is in the set

func (Set[T]) Len

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

Len returns the number of elements in the set

func (Set[T]) Remove

func (s Set[T]) Remove(elt T)

Remove removes an element from the set

Jump to

Keyboard shortcuts

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