set

package
v1.10.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 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[K comparable] struct {
	// contains filtered or unexported fields
}

Set implements a Set, using the go map as the underlying storage.

func New

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

New returns an empty Set.

func Of

func Of[K comparable](vals ...K) Set[K]

Of returns a new Set initialized with the given 'vals'

func (Set[K]) Has

func (s Set[K]) Has(val K) bool

Has returns true only if 'val' is in the set.

func (Set[K]) Put

func (s Set[K]) Put(val K)

Put adds 'val' to the set.

func (Set[K]) Remove

func (s Set[K]) Remove(val K)

Remove removes 'val' from the set.

func (Set[K]) ToArray

func (s Set[K]) ToArray() (arr []K)

ToArray returns go slice

Jump to

Keyboard shortcuts

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