hashtable

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Buckets

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

func NewBuckets

func NewBuckets(size uintptr) *Buckets

func (*Buckets) At

func (b *Buckets) At(i uintptr) *Entry

func (*Buckets) Free

func (b *Buckets) Free()

func (*Buckets) Put

func (b *Buckets) Put(i uintptr, e *Entry)

type Entry

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

func NewEntry

func NewEntry(bucket uintptr, key K, value V) *Entry

func (*Entry) Free

func (e *Entry) Free()

func (*Entry) Get

func (e *Entry) Get(key K) (value V, has bool)

func (*Entry) Put

func (e *Entry) Put(bucket uintptr, key K, value V) (entry *Entry, appended bool)

func (*Entry) Remove

func (e *Entry) Remove(key K) (entry *Entry, removed bool)

type Hashtable

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

func New

func New(size int) *Hashtable

func (*Hashtable) Begin

func (h *Hashtable) Begin() Iterator

func (*Hashtable) Cap

func (h *Hashtable) Cap() int

func (*Hashtable) Each

func (h *Hashtable) Each(f func(key K, value V))

func (*Hashtable) End

func (h *Hashtable) End() Iterator

func (*Hashtable) Free

func (h *Hashtable) Free()

func (*Hashtable) Get

func (h *Hashtable) Get(key K) (V, bool)

func (*Hashtable) Len

func (h *Hashtable) Len() int

func (*Hashtable) Put

func (h *Hashtable) Put(key K, value V)

func (*Hashtable) Remove

func (h *Hashtable) Remove(key K)

func (*Hashtable) String

func (h *Hashtable) String() string

type Iterator

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

func (Iterator) IsEnd

func (itr Iterator) IsEnd() bool

func (*Iterator) Key

func (itr *Iterator) Key() K

func (*Iterator) Next

func (itr *Iterator) Next() bool

func (*Iterator) Value

func (itr *Iterator) Value() V

type K

type K = int

type V

type V = int

Jump to

Keyboard shortcuts

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