hash

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Able

type Able interface {
	HashCode() string
}

type Table

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

哈希表的实现

func CreateHashTable

func CreateHashTable(capacity int,
	comparator func(thisKey interface{}, compareKey interface{}) int) *Table

comparator 可以为空,但是必须实现了common.CompareAble接口

func CreateHashTableDeFault

func CreateHashTableDeFault(comparator func(thisKey interface{},
	compareKey interface{}) int) *Table

创建hash表

func (Table) Contains

func (table Table) Contains(key interface{}) bool

查询是否包含某个key

func (Table) Get

func (table Table) Get(key interface{}) interface{}

查询某个key对应的value

func (Table) GetSize

func (table Table) GetSize() int

func (*Table) Put

func (table *Table) Put(key interface{}, value interface{})

添加或者修改某个key对应的value key 如果不是int float64 string 类型,那么必须实现hash.Able接口

func (*Table) Remove

func (table *Table) Remove(key interface{}) interface{}

删除某个key

Jump to

Keyboard shortcuts

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