set

package
v1.0.89 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: BSD-3-Clause 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 added in v1.0.55

type Set[K comparable] interface {
	// Add adds the element(s) to the set
	Add(elements ...K)
	// Remove removes the element(s) from the set, if they are included
	Remove(elements ...K)
	// Exists returns true if the element exists in the set
	Exists(element K) bool
	// Elements returns the elements of the set as a slice of strings
	Elements() []K
	// Difference returns a new set containing the elements that are in this set but not in s
	Difference(s Set[K]) Set[K]
	// Size returns the size of the set
	Size() int
	// Empty returns true if this set is empty
	Empty() bool
}

func NewSet added in v1.0.55

func NewSet[K comparable](elements ...K) Set[K]

NewSet returns a new Set for the given comparable type

type StringSet

type StringSet interface {
	// Add adds the element(s) to the set
	Add(elements ...string)
	// Remove removes the element(s) from the set, if they are included
	Remove(elements ...string)
	// Exists returns true if the element exists in the set
	Exists(element string) bool
	// Elements returns the elements of the set as a slice of strings
	Elements() []string
	// Difference returns a new set containing the elements that are in this set but not in s
	Difference(s StringSet) StringSet
	// Size returns the size of the set
	Size() int
	// Empty returns true if this set is empty
	Empty() bool
}

func NewStringSet

func NewStringSet(elements ...string) StringSet

NewStringSet returns a new StringSet

Jump to

Keyboard shortcuts

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