hashmap

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

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

HashMap implements a hash map

func NewHashMap

func NewHashMap() *HashMap

NewHashMap return a HashMap instance

func NewHashMapWithCapacity

func NewHashMapWithCapacity(size, capacity uint64) *HashMap

NewHashMapWithCapacity return a HashMap instance with given size and capacity

func (*HashMap) Contains

func (hm *HashMap) Contains(key any) bool

Contains checks if given key is in hashmap or not

func (*HashMap) Delete

func (hm *HashMap) Delete(key any)

Delete item by given key in hashmap

func (*HashMap) Get

func (hm *HashMap) Get(key any) any

Get return the value of given key in hashmap

func (*HashMap) GetOrDefault

func (hm *HashMap) GetOrDefault(key any, defaultValue any) any

GetOrDefault return the value of given key in hashmap, if not found return default value

func (*HashMap) Iterate

func (hm *HashMap) Iterate(iteratee func(key, value any))

Iterate executes iteratee funcation for every key and value pair of hashmap (random order)

func (*HashMap) Keys

func (hm *HashMap) Keys() []any

Keys returns a slice of the hashmap's keys (random order)

func (*HashMap) Put

func (hm *HashMap) Put(key any, value any)

Put new key value in hashmap

func (*HashMap) Values

func (hm *HashMap) Values() []any

Values returns a slice of the hashmap's keys (random order)

Jump to

Keyboard shortcuts

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