hashmap

package
Version: v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: GPL-2.0 Imports: 1 Imported by: 1

Documentation

Overview

This package defines a generic hashmap This hashmap can store any Hasher object as key and any object as value. Similarly to Java HashMap, Hasher objects must define two functions: - HashCode and - HashEquals

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket []*KeyValue

type HashMap

type HashMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewHashMap

func NewHashMap(size uint64, loadfactor float64) *HashMap

Initializes a HashMap

func (*HashMap) KeyValues

func (em *HashMap) KeyValues() []*KeyValue

func (*HashMap) Keys

func (em *HashMap) Keys() []Hasher

Returns all keys of the index

func (*HashMap) PutValue

func (em *HashMap) PutValue(h Hasher, value interface{})

func (*HashMap) Value

func (em *HashMap) Value(h Hasher) (interface{}, bool)

Returns the count for the given Edge If the edge is not present, returns 0 and false If the edge is present, returns the value and true

type Hasher

type Hasher interface {
	HashCode() uint64
	HashEquals(k Hasher) bool
}

type KeyValue

type KeyValue struct {
	Key   Hasher
	Value interface{}
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL