datastructure

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package datastructure implements some data structure. eg. list, linklist, stack, queue, tree, graph.

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) 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