hashtable

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 7 Imported by: 0

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