set

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 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]unit

Set is an unordered set of values of type T.

func FromKeys

func FromKeys[M ~map[K]V, K comparable, V any](m M) Set[K]

FromKeys builds a set from the keys of a map.

func FromSlice

func FromSlice[T comparable](keys []T) Set[T]

FromSlice returns a set containing the values in the given slice.

func New

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

New returns a empty set.

func (*Set[T]) Contains

func (s *Set[T]) Contains(val T) bool

Contains checks whether the passed-in value is present in the Set.

func (*Set[T]) Insert

func (s *Set[T]) Insert(val T)

Insert adds the passed-in value to the Set.

func (*Set[T]) Remove

func (s *Set[T]) Remove(val T)

Remove removes the passed-in value from the Set.

func (Set[T]) ToSlice

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

ToSlice builds a new slice, populates it with the contents of the Set, and returns it.

Jump to

Keyboard shortcuts

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