hashmap

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 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[K comparable, V comparable] struct {
	// contains filtered or unexported fields
}

HashMap is the main hash map type.

func New

func New[K comparable, V comparable]() HashMap[K, V]

New is used to create a new map.

func (*HashMap[K, V]) Clear

func (m *HashMap[K, V]) Clear()

Clear empties the entire hash map.

func (HashMap[K, V]) ContainsKey

func (m HashMap[K, V]) ContainsKey(key K) bool

ContainsKey returns true if the passed key is present, false if not.

func (HashMap[K, V]) ContainsValue

func (m HashMap[K, V]) ContainsValue(val V) bool

ContainsValue returns true if the passed value is present, false if not.

func (HashMap[K, V]) Count

func (m HashMap[K, V]) Count() int

Count returns the amount of entries in the map.

func (HashMap[K, V]) Empty

func (m HashMap[K, V]) Empty() bool

Empty returns true if the map is empty, false if not.

func (HashMap[K, V]) ForEach

func (m HashMap[K, V]) ForEach(f func(key K, val V))

ForEach iterates over the dataset within the hash map, calling the passed function for each value.

func (HashMap[K, V]) Get

func (m HashMap[K, V]) Get(key K) (val V, ok bool)

Get gets a value from the hash map relating to the passed key.

func (*HashMap[K, V]) Put

func (m *HashMap[K, V]) Put(key K, val V)

Put adds a value to the hash map relating to the passed key.

func (*HashMap[K, V]) Remove

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

Remove deletes a value from the hash map relating to the passed key.

Jump to

Keyboard shortcuts

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