set

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

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

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSet

func IsSet(value interface{}) bool

func IsSuperset

func IsSuperset(one Set, other Set) bool

判断集合 one 是否是集合 other 的超集

Types

type HashSet

type HashSet struct {
	// contains filtered or unexported fields
}

func NewHashSet

func NewHashSet() *HashSet

func (*HashSet) Add

func (set *HashSet) Add(e interface{}) bool

func (*HashSet) Clear

func (set *HashSet) Clear()

func (*HashSet) Contains

func (set *HashSet) Contains(e interface{}) bool

func (*HashSet) Elements

func (set *HashSet) Elements() []interface{}

func (*HashSet) Len

func (set *HashSet) Len() int

func (*HashSet) Range

func (set *HashSet) Range(callback func(element interface{}))

func (*HashSet) Remove

func (set *HashSet) Remove(e interface{})

func (*HashSet) Same

func (set *HashSet) Same(other Set) bool

func (*HashSet) String

func (set *HashSet) String() string

type Set

type Set interface {
	Add(e interface{}) bool
	Remove(e interface{})
	Clear()
	Contains(e interface{}) bool
	Len() int
	Same(other Set) bool
	Elements() []interface{}
	String() string
}

func Difference

func Difference(one Set, other Set) Set

生成集合 one 对集合 other 的差集

func Intersect

func Intersect(one Set, other Set) Set

生成集合 one 和集合 other 的交集

func NewSimpleSet

func NewSimpleSet() Set

func SymmetricDifference

func SymmetricDifference(one Set, other Set) Set

生成集合 one 和集合 other 的对称差集

func Union

func Union(one Set, other Set) Set

生成集合 one 和集合 other 的并集

type StringList

type StringList []string

StringList is a list of string (slice)

func (*StringList) Append

func (sl *StringList) Append(elem string)

Append add the string to the end of StringList

func (*StringList) Find

func (sl *StringList) Find(s string) int

Find get the index of string in StringList, returns -1 if not found

func (*StringList) Remove

func (sl *StringList) Remove(elem string)

Remove removes the string from StringList

type StringSet

type StringSet map[string]struct{}

StringSet is a collection of strings

func (StringSet) Add

func (ss StringSet) Add(elem string)

Add adds the string to StringSet

func (StringSet) Contains

func (ss StringSet) Contains(elem string) bool

Contains checks if Stringset contains the string

func (StringSet) IsEmpty

func (ss StringSet) IsEmpty() bool

Remove removes the string from StringList

func (StringSet) Remove

func (ss StringSet) Remove(elem string)

Remove removes the string from StringList

func (StringSet) ToList

func (ss StringSet) ToList() []string

ToList convert StringSet to string slice

Jump to

Keyboard shortcuts

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