hashmap

package
v0.0.0-...-955cc57 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCapacity   = 10
	DefaultLoadFactor = 0.75
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

type HashMap

type HashMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](opts ...Opt) *HashMap[K, V]

func (*HashMap[K, V]) All

func (hm *HashMap[K, V]) All() iter.Seq2[K, V]

func (*HashMap[K, V]) Empty

func (hm *HashMap[K, V]) Empty() bool

func (*HashMap[K, V]) Get

func (hm *HashMap[K, V]) Get(key K) (V, bool)

func (*HashMap[K, V]) Keys

func (hm *HashMap[K, V]) Keys() iter.Seq[K]

func (*HashMap[K, V]) Put

func (hm *HashMap[K, V]) Put(key K, value V)

func (*HashMap[K, V]) Remove

func (hm *HashMap[K, V]) Remove(key K)

func (*HashMap[K, V]) Size

func (hm *HashMap[K, V]) Size() int

func (*HashMap[K, V]) Values

func (hm *HashMap[K, V]) Values() iter.Seq[V]

type MapWrapper

type MapWrapper[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func Wrap

func Wrap[K comparable, V any](m map[K]V) *MapWrapper[K, V]

func (*MapWrapper[K, V]) All

func (hm *MapWrapper[K, V]) All() iter.Seq2[K, V]

func (*MapWrapper[K, V]) Empty

func (hm *MapWrapper[K, V]) Empty() bool

func (*MapWrapper[K, V]) Get

func (hm *MapWrapper[K, V]) Get(key K) (V, bool)

func (*MapWrapper[K, V]) Keys

func (hm *MapWrapper[K, V]) Keys() iter.Seq[K]

func (*MapWrapper[K, V]) Put

func (hm *MapWrapper[K, V]) Put(key K, value V)

func (*MapWrapper[K, V]) Remove

func (hm *MapWrapper[K, V]) Remove(key K)

func (*MapWrapper[K, V]) Size

func (hm *MapWrapper[K, V]) Size() int

func (*MapWrapper[K, V]) Values

func (hm *MapWrapper[K, V]) Values() iter.Seq[V]

type Opt

type Opt func(*Config)

func Capacity

func Capacity(capacity int) Opt

func LoadFactor

func LoadFactor(loadFactor float64) Opt

Jump to

Keyboard shortcuts

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