setutil

package
v0.0.0-...-09efcc3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identity

func Identity[T any](t T) T

func SetToSlice

func SetToSlice[A any, B cmp.Ordered](slice []A, set Set[B], f func(a A) B) []A

Types

type Set

type Set[T cmp.Ordered] map[T]struct{}

func NewSetFromSlice

func NewSetFromSlice[A any, B cmp.Ordered](slice []A, f func(a A) B) Set[B]

func (*Set[T]) Add

func (s *Set[T]) Add(key T)

func (*Set[T]) Delete

func (s *Set[T]) Delete(key T)

func (Set[T]) Has

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

func (Set[T]) Keys

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

func (*Set[T]) Merge

func (s *Set[T]) Merge(other Set[T]) Set[T]

func (Set[T]) Subtract

func (s Set[T]) Subtract(that Set[T]) Set[T]

Jump to

Keyboard shortcuts

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