set

package
v0.0.0-...-d7c879d Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BstSet

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

func CreateBstSet

func CreateBstSet(comparator func(thisValue interface{}, compareValue interface{}) int) BstSet

创建二分搜索树实现的集合

func (BstSet) Add

func (b BstSet) Add(value interface{})

func (BstSet) Contains

func (b BstSet) Contains(value interface{}) bool

func (BstSet) GetSize

func (b BstSet) GetSize() int

func (BstSet) IsEmpty

func (b BstSet) IsEmpty() bool

func (BstSet) Remove

func (b BstSet) Remove(value interface{}) error

func (BstSet) String

func (b BstSet) String() string

type Set

type Set interface {
	fmt.Stringer

	/*
		添加元素
		添加重复的元素会被覆盖
	*/
	Add(value interface{})

	/*
		删除元素
	*/
	Remove(value interface{}) error

	/*
		查询结合中是否包含某一元素
	*/
	Contains(value interface{}) bool

	/*
		查看集合元素个数
	*/
	GetSize() int

	/*
		是否为空
	*/
	IsEmpty() bool
}

集合的解耦定义

Jump to

Keyboard shortcuts

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