set

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSet

func IsSet(value interface{}) bool

IsSet will 判断是否为Set

func IsSuperset

func IsSuperset(one Set, other Set) bool

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

Types

type HashSet

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

HashSet define HashSet

func (*HashSet) Add

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

Add will 添加,并返回是否已经添加

func (*HashSet) AddArray

func (set *HashSet) AddArray(e ...interface{}) []interface{}

AddArray will 添加一个序列,并返回真正添加的序列

func (*HashSet) Clear

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

Clear will 清空

func (*HashSet) Contains

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

Contains will 是否存在

func (*HashSet) Elements

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

Elements will 返回所有值

func (*HashSet) Len

func (set *HashSet) Len() int

Len will 返回是否存在

func (*HashSet) Remove

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

Remove will 移除

func (*HashSet) Same

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

Same will 判断是否相等

func (*HashSet) String

func (set *HashSet) String() string

String will 生成可视化输出

type Set

type Set interface {
	Add(e interface{}) (added bool)
	AddArray(e ...interface{}) (addedKeys []interface{})
	Remove(e interface{}) (exist bool)
	Clear() (keys []interface{})
	Contains(e interface{}) (exist bool)
	Len() int
	Same(other Set) bool
	Elements() []interface{}
	String() string
}

Set define Set

func Difference

func Difference(one Set, other Set) Set

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

func Intersect

func Intersect(one Set, other Set) Set

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

func NewSimpleSet

func NewSimpleSet() Set

NewSimpleSet will 生成新set

func SymmetricDifference

func SymmetricDifference(one Set, other Set) Set

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

func Union

func Union(one Set, other Set) Set

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

Jump to

Keyboard shortcuts

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