set

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: LGPL-3.0 Imports: 1 Imported by: 430

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ints

type Ints map[int]bool

Ints represents the classic "set" data structure, and contains ints.

func NewInts

func NewInts(initial ...int) Ints

NewInts creates and initializes an Ints and populates it with initial values as specified in the parameters.

func (Ints) Add

func (is Ints) Add(value int)

Add puts a value into the set.

func (Ints) Contains

func (is Ints) Contains(value int) bool

Contains returns true if the value is in the set, and false otherwise.

func (Ints) Difference

func (is Ints) Difference(other Ints) Ints

Difference returns a new Ints representing all the values in the target that are not in the parameter.

func (Ints) Intersection

func (is Ints) Intersection(other Ints) Ints

Intersection returns a new Ints representing a intersection of the elments in the method target and the parameter.

func (Ints) IsEmpty

func (is Ints) IsEmpty() bool

IsEmpty is true for empty or uninitialized sets.

func (Ints) Remove

func (is Ints) Remove(value int)

Remove takes a value out of the set. If value wasn't in the set to start with, this method silently succeeds.

func (Ints) Size

func (is Ints) Size() int

Size returns the number of elements in the set.

func (Ints) SortedValues

func (is Ints) SortedValues() []int

SortedValues returns an ordered slice containing all the values in the set.

func (Ints) Union

func (is Ints) Union(other Ints) Ints

Union returns a new Ints representing a union of the elments in the method target and the parameter.

func (Ints) Values

func (is Ints) Values() []int

Values returns an unordered slice containing all the values in the set.

type Strings

type Strings map[string]bool

Strings represents the classic "set" data structure, and contains strings.

func NewStrings

func NewStrings(initial ...string) Strings

NewStrings creates and initializes a Strings and populates it with initial values as specified in the parameters.

func (Strings) Add

func (s Strings) Add(value string)

Add puts a value into the set.

func (Strings) Contains

func (s Strings) Contains(value string) bool

Contains returns true if the value is in the set, and false otherwise.

func (Strings) Difference

func (s Strings) Difference(other Strings) Strings

Difference returns a new Strings representing all the values in the target that are not in the parameter.

func (Strings) Intersection

func (s Strings) Intersection(other Strings) Strings

Intersection returns a new Strings representing a intersection of the elments in the method target and the parameter.

func (Strings) IsEmpty

func (s Strings) IsEmpty() bool

IsEmpty is true for empty or uninitialized sets.

func (Strings) Remove

func (s Strings) Remove(value string)

Remove takes a value out of the set. If value wasn't in the set to start with, this method silently succeeds.

func (Strings) Size

func (s Strings) Size() int

Size returns the number of elements in the set.

func (Strings) SortedValues

func (s Strings) SortedValues() []string

SortedValues returns an ordered slice containing all the values in the set.

func (Strings) Union

func (s Strings) Union(other Strings) Strings

Union returns a new Strings representing a union of the elments in the method target and the parameter.

func (Strings) Values

func (s Strings) Values() []string

Values returns an unordered slice containing all the values in the set.

Jump to

Keyboard shortcuts

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