package module
Version: v0.0.0-...-e51f7fa Latest Latest

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

Go to latest
Published: Jul 14, 2019 License: GPL-3.0 Imports: 1 Imported by: 0


Concurrent Map

Go concurrent map implementation

GoDoc Go Report Card GoCover

How to use

Simple usage:

import (


func main() {
	m := concurrentmap.New()
	m.Put(42, "answer")

	value, found := m.Get(42)
	if found {
		fmt.Printf("Value: %v\n", value)

	fmt.Printf("Map size: %v\n", m.Size())





This section is empty.


This section is empty.


This section is empty.


type Map

type Map struct {
	// contains filtered or unexported fields

Map is a thread-safe map

func New

func New() *Map

New returns a new thread-safe map

func (*Map) ComputeIfAbsent

func (m *Map) ComputeIfAbsent(key interface{}, compFunction func(key interface{}) interface{}) (value interface{}, computed bool)

ComputeIfAbsent check if the specified key is not already associated with a value, attempts to compute its value using the given mapping function and enters it into this map.

func (*Map) Contains

func (m *Map) Contains(key interface{}) bool

Contains returns true if the specified key exists.

func (*Map) Get

func (m *Map) Get(key interface{}) (value interface{}, found bool)

Get returns the value to which the specified key is mapped.

func (*Map) Put

func (m *Map) Put(key interface{}, value interface{}) interface{}

Put associates the specified value with the specified key.

func (*Map) Remove

func (m *Map) Remove(key interface{}) (found bool)

Remove the entry associated with the specified key.

func (*Map) Size

func (m *Map) Size() (size int)

Size returns the number of items in this map

Source Files


Path Synopsis

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