set

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 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 map as a set data structure.

func New

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

New creates an empty Set for elements of type T.

func NewWithSize

func NewWithSize[T comparable](size int) Set[T]

NewWithSize creates an empty Set of fixed size for elements of type T.

func (Set[T]) Add

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

Add adds the element of type T into the Set.

func (Set[T]) Contains

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

Contains checks if element exists in the Set.

Jump to

Keyboard shortcuts

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