set

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 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 represents a generic set data structure.

func New

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

New creates a new set and initializes it with the provided elements.

func (Set[T]) Add

func (s Set[T]) Add(element T)

Add inserts the specified element into the set.

func (Set[T]) Contains

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

Contains checks if the set contains the specified element.

func (Set[T]) Remove

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

Remove deletes the specified element from the set.

func (Set[T]) ToSlice

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

ToSlice converts the set to a slice of its elements.

Jump to

Keyboard shortcuts

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