A threadsafe bidirectional map written in Go
Find a file
2017-03-26 11:35:08 -04:00
.gitignore Bimap 2016-11-09 20:45:07 -05:00
bimap.go Fix naming convention 2016-12-17 11:52:28 -05:00
bimap_test.go Fix naming convention 2016-12-17 11:52:28 -05:00
LICENSE Create LICENSE 2017-03-26 11:35:08 -04:00
README.md Fix naming convention 2016-12-17 11:52:28 -05:00

bimap

A bidirectional map written in Go

Installation

go get github.com/vishalkuo/bimap

Usage

import "github.com/vishalkuo/bimap"

biMap := bimap.NewBiMap()
biMap.Insert("key", "value")
val, ok := biMap.GetInverse("value") // val should be "key", ok should be true
biMap.Delete("key")
biMap.Size() // == 0

biMap2 := bimap.NewBiMap()
biMap2.Insert("key", 1) // Notice different types
val, ok := biMap2.Get("key") // Returns 1
val, ok = biMap2.GetInverse(1) // Returns "key"