datastructs

package
v0.0.0-...-1f26eb9 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT 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 struct {
	Elems map[string]bool `json:"elements"`
}

Set struct has one attribute elements that holds true when an element is in the set

func SetFromSlice

func SetFromSlice(slice []string) Set

SetFromSlice creates a set from a slice

func SetUnion

func SetUnion(s1, s2 Set) Set

return a new set as the union of two sets

func (Set) Add

func (s Set) Add(elem string)

Add elem to set s

func (Set) Check

func (s Set) Check(elem string) bool

Check if elem is contained within set s

func (Set) Del

func (s Set) Del(elem string)

Del deletes elem from set s

func (Set) SetElemsFromSlice

func (s Set) SetElemsFromSlice(slice []string)

SetElemsFromSlice replaces the elements of a set by the contents of a slice

func (Set) ToSlice

func (s Set) ToSlice() []string

ToSlice returns the elements of a set as a slice

Jump to

Keyboard shortcuts

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