Help us shape the future of Go! Take the 2026 Go Developer Survey

hashmap

package module
v0.0.0-...-a72d37f Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2012 License: MIT Imports: 3 Imported by: 0

README

incomplete

Documentation

Overview

Package hashmap implements a simple non-blocking (lock-free) hash map.

The semantics of this hashmap are quite different from the go built-in. Aside from thread-safety, any values (including structs and slices) are allowed as keys, and a value of nil is indestinguishable from an element not being in the map.

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
}

func New

func New() *Hashmap

Creates a hashmap with the default initial capacity (32). The hashmap will be grown to twice its size when the number of entries reaches 50% of the capacity.

func NewCap

func NewCap(c uint32) *Hashmap

Creates a hashmap with the specified initial capacity.

func (*Hashmap) Capacity

func (hm *Hashmap) Capacity() uint32

Returns the capacity of this hashmap.

func (*Hashmap) Del

func (hm *Hashmap) Del(k interface{}) bool

Deletes the given key from the map, and returns true if it existed. Although this method is semantically equivalent to m.Set(k, nil), this method will not allocate another key if the key is not already in use, and should therefore be used instead.

func (*Hashmap) Get

func (hm *Hashmap) Get(k interface{}) interface{}

func (*Hashmap) Grow

func (hm *Hashmap) Grow(c uint32)

func (*Hashmap) Set

func (hm *Hashmap) Set(k interface{}, v interface{})

The key will be (shallowly) copied - the value will not.

func (*Hashmap) Size

func (hm *Hashmap) Size() uint32

Returns the size of this hashmap. This is /not/ the number of elements stored - it is the number of keys allocated.

Jump to

Keyboard shortcuts

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