set

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashedSet

type HashedSet[K comparable, T any] struct {
	Hasher func(T) K
	M      map[K]T
	// Less is used to sort the keys of the set when converting to a slice.
	// If Less is nil, the keys will be sorted in an arbitrary order according to [map] iteration.
	Less func(K, K) bool
}

func HashedSetOf

func HashedSetOf[K comparable, T any](hasher func(T) K, vs ...T) HashedSet[K, T]

func (*HashedSet[K, T]) Add

func (s *HashedSet[K, T]) Add(vs ...T)

func (HashedSet[K, T]) Contains

func (s HashedSet[K, T]) Contains(v T) bool

func (HashedSet[K, T]) ContainsAll

func (s HashedSet[K, T]) ContainsAll(vs ...T) bool

func (HashedSet[K, T]) ContainsAny

func (s HashedSet[K, T]) ContainsAny(vs ...T) bool

func (HashedSet[K, T]) Intersection

func (s HashedSet[K, T]) Intersection(other HashedSet[K, T]) HashedSet[K, T]

func (HashedSet[K, T]) Len

func (s HashedSet[K, T]) Len() int

func (HashedSet[K, T]) MarshalYAML

func (s HashedSet[K, T]) MarshalYAML() (interface{}, error)

func (*HashedSet[K, T]) Remove

func (s *HashedSet[K, T]) Remove(v T) bool

func (HashedSet[K, T]) ToMap

func (s HashedSet[K, T]) ToMap() map[K]T

func (HashedSet[K, T]) ToSlice

func (s HashedSet[K, T]) ToSlice() []T

func (HashedSet[K, T]) Union

func (s HashedSet[K, T]) Union(other HashedSet[K, T]) HashedSet[K, T]

func (*HashedSet[K, T]) UnmarshalYAML

func (s *HashedSet[K, T]) UnmarshalYAML(node *yaml.Node) error

type Set

type Set[T comparable] map[T]struct{}

func SetOf

func SetOf[T comparable](vs ...T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(vs ...T)

func (Set[T]) AddFrom

func (s Set[T]) AddFrom(other Set[T])

func (Set[T]) Contains

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

func (Set[T]) ContainsAll

func (s Set[T]) ContainsAll(vs ...T) bool

func (Set[T]) ContainsAny

func (s Set[T]) ContainsAny(vs ...T) bool

func (Set[T]) Difference

func (s Set[T]) Difference(other Set[T]) Set[T]

func (Set[T]) Intersection

func (s Set[T]) Intersection(other Set[T]) Set[T]

func (Set[T]) Len

func (s Set[T]) Len() int

func (Set[T]) Remove

func (s Set[T]) Remove(v T) bool

func (Set[T]) String

func (s Set[T]) String() string

func (Set[T]) ToSlice

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

func (Set[T]) Union

func (s Set[T]) Union(other Set[T]) Set[T]

Jump to

Keyboard shortcuts

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