set

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 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 is a collection of unique elements of type T. It is implemented using a map with values of an empty struct.

func New

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

New returns a new empty set of type T.

func (Set[T]) Has

func (s Set[T]) Has(t T) bool

Has returns true if the element t is in the set s, false otherwise.

func (Set[T]) Insert

func (s Set[T]) Insert(t T)

Insert adds the element t to the set s. If t is already in s, it does nothing.

Jump to

Keyboard shortcuts

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