hashmap

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 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 int64, 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() int64
	HashEquals(k Hasher) bool
}

type KeyValue

type KeyValue struct {
	Key   Hasher
	Value interface{}
}

Jump to

Keyboard shortcuts

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